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

Update ngClass.js #6324

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/ng/directive/ngClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ 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 a map object (hash table), then for each key-value pair of the
* object, if the value is truthy, then the key, as a string, is included as a class name.
* Note that no extra quoting of the keys or values is necessary in this case. See the example.
*
*
* 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