Reputation: 479
When I use ng-minlength, and set input field to "x" , the input field doesn't show "x"
<body ng-app="docu" ng-controller="formCtrl">
<input type="text" ng-minlength="4" ng-model="deal.cupon">
</body>
var docu = angular.module('docu', []);
docu.controller('formCtrl', function($scope) {
$scope.deal = {};
$scope.deal.cupon = "x";
});
http://jsfiddle.net/jivangilad/8wmEP/
Upvotes: 1
Views: 161
Reputation: 2667
Since you have used the ng-minlength directive on the input, it will not show your ng-model value until it meets the minimum length criteria that you have specified.
Based on your comment below, I recommend that you take a look at the ng-form directive here. You can use this to encapsulate one to many inputs, selects, etc. and run validation on the fly. This will prevent form submission based on the rules you setup for each control within the form.
Upvotes: 1