ng-minlength is valid when length is 0

Viewed 14244

I'm new to angular and stumbled upon a validation problem in a form. Below is my input field and when I don't enter any value it show's as valid and also 'ng-valid' class is added to it even though I've defined minlength to be 5

<input id="name" type="text" placeholder="Name" ng-model="formdata.name" ng-minlength=5 />

It happens even in angular example - http://docs.angularjs.org/api/ng.directive:input

How can I resolve this?

1 Answers
Related