Created
April 5, 2013 18:12
-
-
Save markalanevans/5321395 to your computer and use it in GitHub Desktop.
#angularjs #ngClass How to use an ngClass expression to set a custom class if a $scope.value is true. For this example, when the validations.shipping_cost_per_item is set, the "error" class will be applied to the outer div.
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
| <div ng-class="{error: validations.shipping_cost_per_item}" class="control-group"> | |
| <label class="control-label">Shipping Cost Per Item</label> | |
| <div class="controls"> | |
| <input class="input-small" type="text" ng-model="merchant.shipping_cost_per_item"/> | |
| <span class="help-inline">{{validations.shipping_cost_per_item}}</span> | |
| </div> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment