我有一个登录屏幕,我只是做登录。 我需要添加记住我并忘记密码功能。 我该怎么办?
我的控制者:
angular.module('starter.controllers', [])
.controller('AppCtrl', function($scope, $ionicModal, $timeout, authService, $state, $http)
{
$scope.loginSubmitted = false;
$scope.myflag = false;
$scope.user = {};
$scope.userData = {};
$scope.doLogin = function() {
$scope.present = 0;
authService.GetByUsername().success(function(data) {
$scope.userData = data;
console.log($scope.userData);
for (var i = 0; i < $scope.userData.length; i++) {
if ($scope.userData[i].username == $scope.user.userName && $scope.userData[i].password == $scope.user.Password) {
$scope.loginstatus=1;
break;
}
}
if($scope.loginstatus==1){
$state.go('app.single')
}
else {
console.log('wrong credentials');
}
}).error(function(err) {
console.log(err);
});
}
})
如果无法编码,请给我一个明确的想法,或者我需要遵循的步骤。
答案 0 :(得分:1)
选中此链接以获取Remember-Me功能..
https://blog.craigpalermo.com/tutorial/angularjs/2015/05/26/remember-me-angularjs.html