The following examples exercise the various inputs.
control is the FormControl instanceplaceholder is the field label that floats when input is presentrequired applies the required * (NOTE: This is not inferred from validators)maxLength counts the characters if provided, looking like an error state if over the max. Max length validation error handling is unnecessary if this is used.tooltip is a tooltiperrorMessages overrides the default messages for the validation type. A function can be provided that takes in the error.
required, minlength, and maxlength<va-input-textarea [placeholder]="'Placeholder'" [required]="true" [control]="control1" [tooltip]="'default validators'"></va-input-textarea>
<va-input-textarea [placeholder]="'Placeholder'" [required]="true" [maxLength]='100' [control]="control2" [tooltip]="'custom validators'" [errorMessages]="customErrorMessage"></va-input-textarea>class FormsInputTextareaDocComponent {
...
public customErrorMessage: ErrorMessagesMap = {
'required': 'Its required!!!!',
};
...
constructor(..., private fb: FormBuilder) {
this.control1 = this.fb.control('');
this.control2 = this.fb.control('', [Validators.required, Validators.maxLength(100)]);
}
}