Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body ng-app="simpleValidationExample">
- <div ng-controller="MainCtrl">
- <h1>Simple ngMessages Validation Example</h1>
- <p>User will not be notified of errors untill a submit has been attempted on the form</p>
- <form name="simpleForm" ng-submit="processForm(simpleForm)" novalidate>
- <ul class="form" ng-class="{ 'form--submitAttempted' : submitAttempted }">
- <li class="form__row">
- <input class="form__input"
- type="text"
- placeholder="FIRST NAME"
- maxlength="30"
- name="fname"
- ng-model="firstname"
- required />
- <div ng-messages="simpleForm.fname.$error" class="form__error">
- <div ng-message="required">Required</div>
- </div>
- </li>
- <li class="form__row">
- <input type="email"
- class="form__input"
- placeholder="EMAIL"
- name="email"
- ng-model="emailAddr"
- required />
- <div ng-messages="simpleForm.email.$error" class="form__error">
- <div ng-message="required">Required</div>
- <div ng-message="email">Please enter a valid email address</div>
- </div>
- </li>
- <li class="form__row">
- <button class="form__input form__input--submit">SUBMIT</button>
- </li>
- </ul>
- </form>
- </div>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement