我有一個示例angularjs登錄頁面,現在我想爲我的腳本添加功能以記住密碼。在angularjs中記住密碼選項
<body ng-app="app" >
<div class="main">
<div class="login-form">
<h1>Login</h1>
<form ng-submit=submit()>
<input type="text" name="username" placeholder="USERNAME" ng-model="person.firstName" required />
<span class="error" ng-show="mainForm.usernamename.$error.required">required</span>
<input type="password" name="pswd" placeholder="Password" ng-model="person.pswd" required />
<span class="error" ng-show="mainForm.pswd.$error.required">required</span>
<label>
<input name="remember" type="checkbox" data-ng-model="remember" data-ng-click="rememberMe()"> Remember Me
</label>
<div class="submit">
<input type="submit" value="LOGIN">
</div>
<p><a href="#">Forgot Password ?</a></p>
</form>
</div>
</div>
<script>
angular.module('app', [])
var LoginCtrl= function ($scope) {
$scope.submit = function() {
//return false;
} };
這裏是一個演示過plunker
:https://plnkr.co/edit/4WoGzXnzUfkBqzeFrTW9?p=preview
應該心存感激,如果任何人都可以爲此提供代碼!
你可以保存生成的哈希值,這是在localStorage的密碼或餅乾repesentation –
可能重複:http://stackoverflow.com/questions/18586938/remember-password-with-angularjs- and-ng-submit – tsuz
@Tobias Timm:Iam不知道該怎麼做..你能否提供更好的理解代碼 – Pranitha