in component:
formData.form.controls['email'].setErrors({'incorrect': true});
and in HTML:
<input mdInput placeholder="Email" type="email" name="email" required [(ngModel)]="email" #email="ngModel">
<div *ngIf="!email.valid">{{email.errors| json}}</div>
More Related Contents:
- Min / Max Validator in Angular 2 Final
- How to add form validation pattern in Angular 2?
- Angular 2 form validations start date
- JSF doesn’t support cross-field validation, is there a workaround?
- Do I really need to encode ‘&’ as ‘&’?
- What is the maximum length of a valid email address?
- Disable validation of HTML5 form elements
- Why is client-side validation not enough?
- Validation Error: Value is not valid
- Angular how to get the multiple checkbox values?
- Is JSF validation client-side or server-side?
- How to check whether a file is valid UTF-8?
- Angular 2: Get Values of Multiple Checked Checkboxes
- Angular2 – FormControl Validation on blur
- How to force MVC to Validate IValidatableObject
- How to make a disabled reactive form Editable in Angular2
- What are the practical differences between template-driven and reactive forms?
- How to skip validation when a specific button is clicked?
- Angular 2 Form “Cannot find control with path”
- Angular2 – Validate and submit form from outside
- Using validator with a variable attribute in ui:repeat
- The pipe ‘ ‘ could not be found angular2 custom pipe
- What’s the appropriate HTTP status code to return if a user tries logging in with an incorrect username / password, but correct format?
- How to reset form validation on submission of the form in ANGULAR 2
- How to handle set based consistency validation in CQRS?
- Why does allow blank spaces?
- How to clear form after submit in Angular 2?
- How to validate white spaces/empty spaces? [Angular 2]
- Angular2 Error: There is no directive with “exportAs” set to “ngForm”
- How do you perform address validation? [closed]