| Start |
|---|
| Three types of ng-class expressions Angular supports three types of expressions in the 1. StringSpecifying an expression that evaluates to a string tells Angular to treat it as a $scope variable. Angular will check the $scope and look for a variable called "MyClass". Whatever text is contained in "MyClass" will become the actual class name that is applied to this In your controller, you may have a definition that looks like this: Angular will evaluate the expression Specifying classes this way lets you easily change the class definitions in your controller. For example, you may need to change the class based on other user interactions or new data that is loaded from the server. Also, if you have a lot of expressions to evaluate, you can do so in a function that defines the final list of classes in a 2. ObjectThis is the most commonly-used way of defining classes using Specify an object containing key-value pairs. The key is the class name that will be applied if the value (a conditional) evaluates as true. 3. ArrayAn expression that evaluates to an array lets you use a combination of strings (see #1 above) and conditional objects (#2 above). This creates a text input field bound to the scope variable |
Read Article
https://develop.horje.com/learn/1434/reference