diff options
| author | Brad Williams | 2014-02-18 12:44:51 -0800 | 
|---|---|---|
| committer | Tobias Bosch | 2014-02-18 15:08:30 -0800 | 
| commit | 21dac2a3daae528471d5e767072b10e1491f2106 (patch) | |
| tree | 89801aa6f8722b8267f23cae0714069c55273ecd | |
| parent | 481508d0e7ae9e4984ea380b9a43e589551c7a5b (diff) | |
| download | angular.js-21dac2a3daae528471d5e767072b10e1491f2106.tar.bz2 | |
docs(ngClass): Explain all 3 ways how to use ngClass
Closes #6324.
| -rw-r--r-- | src/ng/directive/ngClass.js | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/src/ng/directive/ngClass.js b/src/ng/directive/ngClass.js index 595b4419..47a4d5c7 100644 --- a/src/ng/directive/ngClass.js +++ b/src/ng/directive/ngClass.js @@ -71,6 +71,18 @@ function classDirective(name, selector) {   * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding   * an expression that represents all classes to be added.   * + * The directive operates in three different ways, depending on which of three types the expression + * evaluates to: + * + * 1. If the expression evaluates to a string, the string should be one or more space-delimited class + * names. + * + * 2. If the expression evaluates to an array, each element of the array should be a string that is + * one or more space-delimited class names. + * + * 3. If the expression evaluates to an object, then for each key-value pair of the + * object with a truthy value the corresponding key is used as a class name. + *   * The directive won't add duplicate classes if a particular class was already set.   *   * When the expression changes, the previously added classes are removed and only then the | 
