是否有NG-模型和输入型电子邮件的错误?模型、电子邮件、错误、NG

2023-09-14 00:21:31 作者:林中远鹤

是不是有什么特殊的输入型=电子邮件和NG-模型属性怎么回事?如果输入是电子邮件,则该模型犯规更新。如果我改变输入类型为文本,数字或日期是正确更新。

Is there something special going on with input type="email" and ng-model attribute? If the input is email, then the model doesnt update. If I change the input type to text, number or date it updates correctly.

错误,或者我不明白一些特殊的魔法电子邮件验证行为?

Bug or some special magic email validation behavior that I dont understand?

推荐答案

它做对,然后输入一些验证,所以你需要之前它被绑定到模型进入了一个有效的电子邮件地址。

It does some validation on then input, so you need to have entered a valid email address before it is bound to the model.

这是用于正则表达式

/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/

基本上你需要输入至少是一个地址 a@b.co