修改密码逻辑思维
首先要输入旧的密码,判断旧的密码是否正确(后台判断)
其次输入新的密码,判断新密码格式(可增加)
最后判断新密码和确认密码输入是否一致
html部分
AngularJS部分
.controller('userpswdCtrl', function($scope,Account,Sweetalert,$state,$localStorage){
$scope.user = {}; //信息全部存在user里面
$scope.changePassword = function(){
if($scope.password_again === $scope.user.newPassword){ //如果两次密码输入一致
$scope.user.accountId = $localStorage.accountId; //获取用户id
Account.modifyPassword($scope.user,function(data){ //修改密码
console.log(data);
Sweetalert.swal({
title:'',
text: "修改成功",
type: "success",
showCancelButton: false,
/confirm/iButtonColor: "#DD6B55",
/confirm/iButtonText: "是",
cancelButtonText: "否",
closeOn/confirm/i: true,
closeOnCancel: true
})
},function(){
})
}
}
})
以上所述是小编给大家介绍的Angularjs修改密码的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对考高分网网站的支持!



