Angular2 - FormControl Validation on blur

前端 未结 6 1758
耶瑟儿~
耶瑟儿~ 2020-11-27 14:26

I\'m looking at adding some basic email validation to check that the user has put in a correct email address. Currently using the method below, the validation updates as the

6条回答
  •  长情又很酷
    2020-11-27 15:01

    You may

    [class.has-error]="!form.controls['ctrlEmailAddress'].valid"
    

    This will add has-error class as soon as you will change model. So basically you don't need to blur to have validation check.

    This solved problem with angular 2.0.0 beta ;)

提交回复
热议问题