如何在angular js中为密码输入设置autocomplete = off? [英] How can we make autocomplete=off for password input in angular js?

查看:71
本文介绍了如何在angular js中为密码输入设置autocomplete = off?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 AngularJs 完全陌生.我需要输入密码 autocomplete = off .

I am completely new to AngularJs. I need to make autocomplete=off for a password input.

autocomplete = off 是唯一的方法,还是在 AngularJs 中我们必须以某种不同的方式来做到这一点?

Is autocomplete=off the only way or do we have to do it in some different way in AngularJs?

推荐答案

这与AngularJS完全无关,而只是html.

This doesn't nothing to do with AngularJS at all, but simply html.

关于您的声明,如果密码字段设置为键入 password ,则密码字段不应自动填写,否则,如果您希望将表单中的特定字段设置为自动完成,则可以进行设置将该属性设置为false,例如< input autocomplete ="on | off"> .

Regarding to your statement, password fields shouldn't be autocompleting if they are set to type password, otherwise if you want to set a specific field inside a form to autocomplete off you can do it setting that property to false like this <input autocomplete="on|off">.

这可以在表单级别或输入级别定义.形式如下:

This can be defined at form level or at input level. In a form it would be like this:

<form action="" autocomplete="on|off">
</form>

您还可以在表单级别对其进行定义,并为某些特定的输入覆盖行为,例如:

Also you can define it in a form level, and override the behavior for some specific inputs like this:

<form action="" name="myform" autocomplete="on">
    <input autocomplete="off" name="myInput" >
</form>

在上面的代码中, myform 形式的 autocomplete 处于启用状态,这意味着所有输入(允许输入的内容)都将自动完成,但在输入中 myInput 不会,因为它会覆盖表单行为.

In the above code, in the form myform the autocomplete is on, it means all inputs (the one which allow it) will do autocomplete, but in the input myInput will not, since it overrides the form behavior.

更多信息可以在 HTML自动完成属性

这篇关于如何在angular js中为密码输入设置autocomplete = off?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆