Generic email validator

后端 未结 10 905
灰色年华
灰色年华 2020-11-30 02:01

I want to create a form where the user will enter his email. I\'d like to validate email format client-side.

Is there any generic email validator in Angular 2?

10条回答
  •  失恋的感觉
    2020-11-30 02:31

    I'm using : https://www.npmjs.com/package/ng2-validation

    npm install ng2-validation --save ng2-validation

    I'm not responding exaclty your question but for a lot of common scenarios you can find a custom validator already implemented

    example in your case : email : ['', [CustomValidators.email]]

    Best Reagards,

提交回复
热议问题