实现效果:

 1> 当输入确认密码时验证:  

Angularjs 通过directive实现验证两次输入是否一致的功能

2> 当输入密码时验证:

  Angularjs 通过directive实现验证两次输入是否一致的功能

实现步骤:

1.页面代码:  

<input class="form-control" type="password" id="password" name="password"
                                                   ng-model="user.password"
                                                   match-check="confrimPassword|confrimPassword">

input class="form-control" type="password" id="confrimPassword"
                                                   name="confrimPassword"
                                                   ng-model="user.confrimPassword"
                                                   match-check="password|confrimPassword" onpaste="return false">
                                            <span class=" error"
                                                  ng-show="!form.password.$pristine && !form.confrimPassword.$pristine && form.confrimPassword.$error.match">This does not match the 'Password' entered above.  Please re-enter your password.</span>
View Code

相关文章:

  • 2022-12-23
  • 2021-09-01
  • 2021-12-30
  • 2021-06-15
  • 2022-02-13
  • 2021-08-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2023-04-10
  • 2022-12-23
  • 2021-10-01
相关资源
相似解决方案