Created
November 24, 2014 14:00
-
-
Save EmmanuelDemey/d5fb574a13cd6ca1b9ac to your computer and use it in GitHub Desktop.
Slide 143 - Using form validation methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form name="myForm"> | |
| <h3>Training complaint form</h3> | |
| <!-- Show only if the complaint msg length > 5. --> | |
| <alert type="error" data-ng-if="myForm.txtContent.$error.maxlength"> | |
| Complaint message must be five characters long or less! | |
| </alert> | |
| <!-- Name is required --> | |
| Your name: <input type="text" name="inputName" ng-model="complaint.name" required/> | |
| <!-- Correct mail format + required --> | |
| Your mail: <input type="email" name="inputMail" ng-model="complaint.mail" required/> | |
| <!-- Required + 5 characters max --> | |
| Your complaint: <input type="text" name="txtContent" ng-model="complaint.content" required data-ng-maxlength="5" /> | |
| <!-- Disabled if the form has any error. --> | |
| <button class="btn" ng-click="sendComplaint()">Send</button> | |
| </form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment