svogv
Version:
A decorator based approach for model driven forms, including an advanced DataGrid and a TreeView component.
24 lines (23 loc) • 977 B
TypeScript
import { FormBuilder, FormGroup } from '@angular/forms';
/**
* The form validator service creates a {@link FormGroup} object from a viewmodel. If the viewmodel
* has been decorated with validation decorators the validators are created accordingly.
*
* The simplest way is creating a class with properties and add decorators, such as
* {@link StringLength}. The service will than create a {@link FormGroup} that contains a}validator
* of type {@link StringLength} for the property the decorator is written}on.
*
* The decorators provide properties for additional information, such as a custom error message.
*
*/
export declare class FormValidatorService {
private fb;
constructor(fb: FormBuilder);
/**
* Call this method to actually create the FormGroup object. Provide a valid model type.
*
* @param target A valid model type.
* @returns A FormGroup with validators
*/
build(target: any): FormGroup;
}