Angular 2 Form Errors - like ngMessages in AngularJS but for Angular 2
npm install @angularclass/form-errorsbash
npm install @angularclass/form-errors --save
`* Inputs
*
[errors]: takes an object where the keys match the errors and the value is the message
* Attributes
* control: The control name to determine the errorsAPI
`typescript
@Component({
selector: 'account',
directives: [
...ANGULARCLASS_FORM_ERRORS_DIRECTIVES // [ AcMatchControlValidator ]
]
});
`
`html
`
example
`typescript
import { Component } from '@angular/core';
import { ANGULARCLASS_FORM_ERRORS_DIRECTIVES } from '@angularclass/form-errors';
@Component({
selector: 'account-edit',
directives: [
...ANGULARCLASS_FORM_ERRORS_DIRECTIVES
],
template:
Account:
#accountForm="ngForm"
})
export class AccountEditComponent {
accountForm = {
username: ''
}; onUpdateProfile(json, isValid) {
}
}
``___
enjoy — AngularClass

##AngularClass
> Learn AngularJS, Angular 2, and Modern Web Development from the best.
> Looking for corporate Angular training, want to host us, or Angular consulting? patrick@angularclass.com