angularjs - Error messages are not shown on clicking submit button using angular validation -


i working on angular form validations. apart rest of validations, want if submit form without touching field, error messages should shown in form.here using below code in name field if click on submit button without touching name field error in name field should shown red border not working-

     <div class="form-group" ng-class="{ 'has-error' : myform.name.$invalid && (myform.submitted  || myform.name.$touched ) }">      <label for="username" style="color:#767676" class="" ng-hide="myform.name.$invalid && (myform.submitted  || myform.name.$touched )">name</label>                        <label class="error_message_text" ng-show="myform.name.$invalid && (myform.submitted  || myform.name.$touched )">                             please enter name                         </label><br>     <input type="text" name="name" class="form-control" ng-class="" ng-model="user.name" required/>  </div> 

i have created plunker here- https://plnkr.co/edit/33ebfu7pquzrvyiuwngz?p=preview

can tell me how achieve validation error messages red border on clicking submit button?

instead of myform.submitted use myform.$submitted

<div class="form-group" ng-class="{ 'has-error' : myform.name.$invalid && (myform.$submitted  || myform.name.$touched ) }">     <label for="username" style="color:#767676" class="" ng-hide="myform.name.$invalid && (myform.$submitted  || myform.name.$touched )">name</label>     <label class="error_message_text" ng-show="myform.name.$invalid && (myform.$submitted  || myform.name.$touched )">         please enter name     </label><br>     <input type="text" name="name" class="form-control" ng-class="" ng-model="user.name" required/> </div> 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -