angularjs | form validation | ngMessages not displaying error message -


i able error, field becoming red, showing character count becoming red. error messages not showing . no error found in console. have added angular-1.3.4 ngmessages dependency also. please help.

<div class="col-md-3 col-sm-6 col-xs-12"> <md-input-container flex>           <label>{{field.field_title}}</label>           <input ng-model="field.field_value" name="username" type="text" placeholder="placeholder text"               ng-required="field.field_required" md-maxlength="field.max" >       <div ng-messages="userform.username.$error">          <p ng-message="maxlength">your name long.</p>         <p ng-message="required">your name required.</p>     </div>  </md-input-container> </div> 

keep these attributes of input field simple :

ng-minlength=3 ng-maxlength=20 required

this working code validations :

<form name="signup_form" novalidate ng-submit="signupform()">   <fieldset>     <legend>signup</legend>     <div class="row">       <div class="large-12 columns">         <label>your name</label>         <input type="text"              placeholder="name"              name="name"              ng-model="signup.name"              ng-minlength=3              ng-maxlength=20 required />        <div class="error-container"              ng-show="signup_form.name.$dirty && signup_form.name.$invalid && signup_form.submitted">         <small class="error"              ng-show="signup_form.name.$error.required">             name required.         </small>         <small class="error"                  ng-show="signup_form.name.$error.minlength">                 name required @ least 3 characters         </small>         <small class="error"                  ng-show="signup_form.name.$error.maxlength">                 name cannot longer 20 characters         </small>       </div>       </div>     </div>     <button type="submit" class="button radius">submit</button>   </fieldset> </form> 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -