angularjs - Regex with ng-if -
<div class="row" ng-if="mytest.item.mypassword != mytest.item.confirmpassword"> <div class="col-md-12"> <p class="red-color"> password must between 4 , 8 digits long , include @ least 1 numeric digit , passwords must match! </p> </div> </div>
i need show above message when "mypassword != confirmpassword" , regex '/^(?=.*\d).{4,8}$/' not fulfilled password field.how can use regex ng-if ? highly appreciated.
on view:
ng-if="isvalid()"
in controller:
$scope.isvalid = function(){ return mytest.item.mypassword == mytest.item.confirmpassword && yourregexp.test(mytest.item.mypassword); }
Comments
Post a Comment