Angular 不自动完成电子邮件?

问题描述 投票:0回答:2

您好,我有一个这样的电子邮件输入字段:

 <input class="generic-input" #emailInput autocomplete="new-email" type="text" formControlName="email"
        (blur)="trimSpace()" (keypress)="disallowSpace($event)"
        name="email">

但是我没有像通常的 HTML5 功能那样获得自动完成功能?

angular
2个回答
1
投票

autocomplete
属性没有
new-email
值。您应该只使用
email
来代替。所以你的代码将如下所示:

 <input class="generic-input" #emailInput autocomplete="email" type="text" formControlName="email"
        (blur)="trimSpace()" (keypress)="disallowSpace($event)"
        name="email">

1
投票

这是因为你的自动完成属性有错字:

autocomplete="new-email"

应该改为以下内容:

autocomplete="email"

附注

new-password
是有效选项,而不是
new-email

链接

© www.soinside.com 2019 - 2024. All rights reserved.