File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
modules/angular2/src/directives Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,28 @@ import {IterableChanges} from 'angular2/src/change_detection/pipes/iterable_chan
88import { isPresent , isString , StringWrapper } from 'angular2/src/facade/lang' ;
99import { ListWrapper , StringMapWrapper , isListLikeIterable } from 'angular2/src/facade/collection' ;
1010
11+ /**
12+ * Adds and removes CSS classes based on an {expression} value.
13+ *
14+ * The result of expression is used to add and remove CSS classes using the following logic,
15+ * based on expression's value type:
16+ * - {string} - all the CSS classes (space - separated) are added
17+ * - {Array} - all the CSS classes (Array elements) are added
18+ * - {Object} - each key corresponds to a CSS class name while values
19+ * are interpreted as {boolean} expression. If a given expression
20+ * evaluates to {true} a corresponding CSS class is added - otherwise
21+ * it is removed.
22+ *
23+ * # Example:
24+ *
25+ * ```
26+ * <div class="message" [class]="{error: errorCount > 0}">
27+ * Please check errors.
28+ * </div>
29+ * ```
30+ *
31+ * @exportedAs angular2/directives
32+ */
1133@Directive ( { selector : '[class]' , lifecycle : [ onCheck ] , properties : [ 'rawClass: class' ] } )
1234export class CSSClass {
1335 _pipe : Pipe ;
You can’t perform that action at this time.
0 commit comments