errorMessage

Description

This property is helps to show the error message of the form field.it needs to be contains the property of the validator as key and errormessage as value.

Hint:

  • Type: Object

  • Property of NgMatFormField

Example

Fields: NgMatFormFields[] = [{
    type: 'input',
    label: 'User Name',
    placeholder: 'Enter a User Name',
    formControlName: 'name',
    directive: 'numericOnly',
    maxLength: '10',
    validators: [Validators.required, Validators.email],
    errorMessage: {
        required: 'required!',
        email: 'Please provide valid email'
    }
}];

Last updated