angularjs - Validation message displayed by default -


i enter page , can see validation message immediately.

   <div ng-class="{'has-error': test.$invalid}" class="form-group" >          <input id="field" name="field" required class="form-control" ng-model="field" type="text"/>          <div class="help-block error" ng-show="test.field.$error.required">required</div>       </div> 

link

how can avoid ?

your issue respect fact condition ng-show test.field.$error.required.

what's problem this?

even when page loads, field still not valid email id.

so, what's fix?

you need check user has clicked on field , field no longer pristine.

how that?

in ng-show, add following condition.

test.field.$error.required && test.field.$dirty 

here working demo


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -