确认密码的指令能否更简单点?
能否直接用
ng-if="((password != password2 ) || signUpForm.password2.$invalid) && signUpForm.password2.$touched"
呢???
能否直接用
ng-if="((password != password2 ) || signUpForm.password2.$invalid) && signUpForm.password2.$touched"
呢???
2016-07-03
我没有自己写指令,貌似用下面的代码也可以实现比较哦
<div class="form-group" ng-class="{'has-error':((userdata.password != userdata.confirm) || signUpForm.confirm.$invalid) && signUpForm.confirm.$touched}"> <label for="confirm" class="col-sm-2 control-label">确认密码:</label> <div class="col-sm-10"> <pre>{{userdata.password == userdata.confirm}}</pre> <input type="password" class="form-control" id="confirm" name="confirm" ng-model="userdata.confirm" minlength="6" ng-maxlength="10" placeholder="请输入确认密码" required> <p ng-show="((userdata.password != userdata.confirm) || signUpForm.confirm.$invalid) && signUpForm.confirm.$touched" class="text-danger">两次输入不一致</p> </div> </div>
举报