更改密码按钮,无需使用 comfirmpassword 对 newpassword 进行密码检查确认即可启用?

Change password button enabling without the password check confirmation on newpassword with comfirmpassword?

提问人:Jmp28 提问时间:6/5/2023 最后编辑:mohsen dorparastiJmp28 更新时间:6/5/2023 访问量:27

问:

Ng-disable没有申请使用新密码进行检查。即使编写了适当的指令来比较和检查有效性?changepassword

Passwrod Matching 不起作用。编写代码只是为了启用更改密码并使其相似。但是,在填充新密码占位符后,将启用“更改密码”按钮。newpasswordconfrimpassword

HTMl
<div class="form-group">
<label for="inputPassword" class="col-md-4 control-label">Confirm Password</label>
<div class="col-md-7 col-md-offset-right-1 input-group">
<input type="{{inputType}}" class="form-control" id="pw2" placeholder="Re enter the password" name="pw2" ng-model="forgotPwdkeys.confirmPassword" ng-required="" pw-check="pw1">
<span class="input-group-addon">
<span class="{{showHideClass}}" ng-click="showConfirmPassword()" style="cursor:pointer"></span>
</span>
</div>
<div class="msg-block passwordMask" ng-show="forgotpwdForm.$error"> <span class="msg-error" ng-show="forgotpwdForm.pw2.$error.pwmatch">Passwords don't match.</span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-12" style="text-align:center">
<button class="btn btn-raised btn-primary" ng-disabled="forgotpwdForm.$pristine || forgotpwdForm.$invalid " ng-click="resetNewPwd();">Change</button>
</div>
</div>
directive

MainApp.directive('pwCheck', [function() {
    return {
        require: 'ngModel',
        link: function(scope, elem, attrs, ctrl) {
            var firstPassword = '#' + attrs.pwCheck;
            elem.add(firstPassword).on('keyup', function() {
                scope.$apply(function() {
                    var v = elem.val() === $(firstPassword).val();
                    console.log(v);
                    console.log('pwmatch')
                    ctrl.$setValidity('pwmatch', v);
                });
            });
        }
    }
}]);

`

密码不匹配。
javascript html css, angularjs, 前端

评论


答: 暂无答案