Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
docs(ngClass): Explain all 3 ways how to use ngClass
Browse files Browse the repository at this point in the history
Closes #6324.
  • Loading branch information
bradw2k authored and tbosch committed Feb 18, 2014
1 parent 481508d commit 21dac2a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ng/directive/ngClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 21dac2a

Please sign in to comment.