angularjs - Angular set ng-minlength from controller does not work -


here controller:

    function ctrl($scope) {       $scope.text = 'guest';       $scope.word = /^\w*$/;       $scope.min_length = 4;     } 

here view:

    <form name="myform" ng-controller="ctrl">       single word:        <input type="text" name="input" ng-model="text"              ng-pattern="word" ng-minlength="min_length" required />       ...     </form> 

the ng-minlength="min_length" won't trigger minlength error except explicitly write ng-minlength="4". however, ng-pattern="word" works fine.

here jsfiddle link

is because doing wrong or there way around?

here how ng-minlength

<input ng-minlength="{{ min_length }}" /> 

here working

jsfiddle link


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -