亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

密碼一致性驗證

請問各位大神,怎么用augularjs寫條指令判斷兩次密碼輸入的是否一致呢?

正在回答

1 回答

ResetPasswordApp.directive('pwCheck', [function () {
? ?return {
? ? ? ?restrict: 'A',
? ? ? ?require: "ngModel",
? ? ? ?link: function(scope, elem, attrs, ctrl) {
? ? ? ? ? ?var otherInput = elem.inheritedData("$formController")[attrs.pwCheck];
? ? ? ? ? ?ctrl.$parsers.push(function(value) {
? ? ? ? ? ? ? ?ctrl.$setValidity("pwCheck",value === otherInput.$viewValue);
? ? ? ? ? ? ? ?return value;
? ? ? ? ? ?});

? ? ? ? ? ?otherInput.$parsers.push(function(value) {
? ? ? ? ? ? ? ?ctrl.$setValidity("pwCheck", value === ctrl.$viewValue);
? ? ? ? ? ? ? ?return value;
? ? ? ? ? ?});
? ? ? ?}
? ?};
}]);


<form ng-controller="confimPwFormController" ng-submit="submit()" id="confirmPwForm" name="confirmPwForm">
<div class="form-group">
<input type="password" placeholder="請輸入新密碼" ng-model="confirm.password" ?name="password" required=true class="required form-control" />
</div>
<div class="form-group">
<input type="password" placeholder="請再次輸入新密碼" ng-model="confirm.plainPassword" pw-check="password" ?name="plainPassword" required class="required form-control" />
</div>
<div class="form-group">
<input type="submit" class="btn btn-info btn-block" value="完成" ? ng-disabled="confirmPwForm.$invalid"/>
</div>
</form>



0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
阿里懶懶交流會AngularJS專場
  • 參與學習       38321    人
  • 解答問題       48    個

阿里云前端團隊深度解析AngularJS,深入淺出,干貨不斷,不容錯過

進入課程

密碼一致性驗證

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號