记得AngularJS和密码NG-提交 [英] Remember Password with AngularJS and ng-submit

查看:106
本文介绍了记得AngularJS和密码NG-提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得浏览器要求用户记住密码使用在AngularJS单页的应用程序NG-提交时。

How do I get the browser to ask the user to remember the password when using ng-submit in an AngularJS single page application.

我的方式:

<form action="/#/dashboard/login" onsubmit="return false;" ng-submit="login()" name="loginForm">
    <input type="text" required id="username" name="username" ng-model="username" autocomplete="on" placeholder="Username" value="">
    <input type="password" required id="password" name="password" ng-model="password" autocomplete="on" placeholder="Password" value="">
    <button type="submit" class="btn">Submit</button>
</form>

任何想法?

我刚添加的行动去识别表格,并诱骗记住密码的浏览器。 (这显然没有奏效。)形式工作正常,而不采取行动。在的onsubmit =返回false; prevents动作的执行。只有 NG-提交正在做什么。

I just added the action to get the browser to recognise the form and trick it into remembering the password. (which obviously didn't work.) The form works fine without the action. The onsubmit="return false;" prevents the execution of the action. Only the ng-submit is doing anything.

推荐答案

问题是动态生成的登录表单。把形式进入的index.html后,它工作正常。我想这是一个安全问题。

The problem is the dynamically generated login form. After putting the form into the index.html it worked as expected. I guess this is a security issue.

这则发生的问题是,ngModels没有得到自动填充更新。经过一番搜索,我发现了解决这一问题的这里。在AngularJS 1.2+这应该是固定的。

The problem that then occurred was that the ngModels didn't get updated on autofill. After some searching I found the solution to that problem here. In AngularJS 1.2+ this is supposed to be fixed.

这篇关于记得AngularJS和密码NG-提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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