Angularjs修改密碼的實(shí)例代碼
修改密碼邏輯思維
首先要輸入舊的密碼,判斷舊的密碼是否正確(后臺判斷)
其次輸入新的密碼,判斷新密碼格式(可增加)
最后判斷新密碼和確認(rèn)密碼輸入是否一致
html部分
<form class="form-horizontal" role="form"> <div class="form-group"> <label class="col-sm-2 control-label"><i class="importance">*</i>當(dāng)前密碼</label> <div class="col-sm-6"> <input type="text" class="form-control" ng-model="user.password"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label"><i class="importance">*</i>新密碼</label> <div class="col-sm-6"> <input type="text" class="form-control" ng-model="user.newPassword" ng-minlength="8" ng-maxlength="16" required> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label"><i class="importance">*</i>確認(rèn)新密碼</label> <div class="col-sm-6"> <input type="text" class="form-control" ng-model="password_again"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-default x_submit" ng-click="changePassword()">保存設(shè)置</button> </div> </div> </form>
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, confirmButtonColor: "#DD6B55", confirmButtonText: "是", cancelButtonText: "否", closeOnConfirm: true, closeOnCancel: true }) },function(){ }) } } })
以上所述是小編給大家介紹的Angularjs修改密碼的實(shí)例代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
- angularjs2 ng2 密碼隱藏顯示的實(shí)例代碼
- AngularJS前端頁面操作之用戶修改密碼功能示例
- angular仿支付寶密碼框輸入效果
- 在 Angular2 中實(shí)現(xiàn)自定義校驗(yàn)指令(確認(rèn)密碼)的方法
- AngularJs驗(yàn)證重復(fù)密碼的方法(兩種)
- angularjs 表單密碼驗(yàn)證自定義指令實(shí)現(xiàn)代碼
- Angular實(shí)現(xiàn)點(diǎn)擊按鈕控制隱藏和顯示功能示例
- Angular實(shí)現(xiàn)點(diǎn)擊按鈕后在上方顯示輸入內(nèi)容的方法
- AngularJS實(shí)現(xiàn)根據(jù)不同條件顯示不同控件
- AngularJS實(shí)時(shí)獲取并顯示密碼的方法
相關(guān)文章
angularJs中datatable實(shí)現(xiàn)代碼
本篇文章主要介紹了angularJs中datatable實(shí)現(xiàn)代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-06-06用WebStorm進(jìn)行Angularjs 2開發(fā)(環(huán)境篇:Windows 10,Angular-cli方式)
這篇文章主要介紹了用WebStorm進(jìn)行Angularjs 2開發(fā)(環(huán)境篇:Windows 10,Angular-cli方式),小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-12-12解決Angular.Js與Django標(biāo)簽沖突的方案
AngularJS和django的模板都是用{{}}來引用變量的,這就導(dǎo)致了沖突,所以這篇文章主要就給大家介紹了如何解決Angular.Js與Django標(biāo)簽沖突的方案,有需要的朋友們可以參考借鑒,下面來一起學(xué)習(xí)學(xué)習(xí)吧。2016-12-12angular.js實(shí)現(xiàn)列表orderby排序的方法
今天小編就為大家分享一篇angular.js實(shí)現(xiàn)列表orderby排序的方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-10-10Angular實(shí)現(xiàn)的簡單查詢天氣預(yù)報(bào)功能示例
這篇文章主要介紹了Angular實(shí)現(xiàn)的簡單查詢天氣預(yù)報(bào)功能,涉及AngularJS針對第三方API接口交互的相關(guān)操作技巧,需要的朋友可以參考下2017-12-12關(guān)于Angular2 + node接口調(diào)試的解決方案
這篇文章主要給大家介紹了關(guān)于Angular2 + node接口調(diào)試的解決方案,文中介紹的非常詳細(xì),對大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起看看吧。2017-05-05AngularJS實(shí)現(xiàn)tab選項(xiàng)卡的方法詳解
這篇文章主要介紹了AngularJS實(shí)現(xiàn)tab選項(xiàng)卡的方法,結(jié)合實(shí)例形式較為詳細(xì)的分析了AngularJS實(shí)現(xiàn)tab選項(xiàng)卡的原理、實(shí)現(xiàn)技巧與相關(guān)注意事項(xiàng),需要的朋友可以參考下2017-07-07