Monday, 15 March 2010

How to get validation error value(=inputed value, but not in model) angularjs way -



How to get validation error value(=inputed value, but not in model) angularjs way -

i’m trying user.name.length value @ error message. if jquery used, realizable, isn't there method unique angularjs?

<form novalidate name="myform" ng-submit="adduser()"> <p>name: <input type="text" name="name" ng-model="user.name" required ng-minlength="5" ng-maxlength="8"> <span ng-show="myform.name.$error.minlength">{{user.name.length}} short!</span>

can seek {{myform.name.$viewvalue.length}}, below:

<input type="text" name="name" ng-model="user.name" ng-minlength="5" ng-maxlength="8" /> <span ng-show="myform.name.$error.minlength">{{myform.name.$viewvalue.length}} short!</span> <span ng-show="myform.name.$error.maxlength">{{myform.name.$viewvalue.length}} long!</span>

angularjs

No comments:

Post a Comment