Last active
March 24, 2016 16:07
-
-
Save icfantv/fa77edcb61eb95e1a241 to your computer and use it in GitHub Desktop.
Form Error Reporting in Angular
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
<ng-form name="shoeData"> | |
<div class="container-fluid"> | |
<div class="form-group col-sm-3 col-md-3 col-lg-3" | |
ng-class="{ 'has-error': shoeData.shoeName.$touched && shoeData.shoeName.$invalid }"> | |
<label for="shoe-name" class="control-label"> | |
Name: <span class="text-danger">*</span> | |
</label> | |
<input id="shoe-name" | |
type="text" | |
autocomplete="off" | |
name="shoeName" | |
class="form-control" | |
ng-model="shoeCtrl.shoe.name" | |
ng-maxlength="100" | |
maxlength="100" | |
required | |
auto-focus | |
placeholder="Shoe Name"/> | |
<div class="my-messages" | |
ng-messages="shoeData.shoeName.$error" | |
ng-if="shoeData.shoeName.$touched"> | |
<div class="some-message" ng-message="required">The shoe name is required</div> | |
</div> | |
</div> | |
</div> | |
</ng-form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment