Farata / angular2typescript

Code samples from the book Angular 2 Development with TypeScript
MIT License
440 stars 269 forks source link

chapter 7 Hands on [class...]="formModel.hasError(...)" not working #32

Open canberranet opened 6 years ago

canberranet commented 6 years ago

the validation seems to be working, the form and fields get the ng-valid and ng-invalid class applied. However the has-error never gets applied and [class.hidden]="!formModel.hasError(...)" is not working either

canberranet commented 6 years ago

need to use the form formModel.hasError('minlength', ['title'])

yfain commented 6 years ago

I'll take a look, thanks. Meanwhile, take a look at the validator samples in the 2nd edition of this book. They're in chapter 11 at https://github.com/Farata/angulartypescript.