From f827e1532e0b90e22d98d9acfb45d182e47bbdd7 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Fri, 19 Jun 2015 09:41:58 +0200 Subject: [PATCH] docs(CSSClass): add documentation Closes #2933 --- modules/angular2/src/directives/class.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/angular2/src/directives/class.ts b/modules/angular2/src/directives/class.ts index 57b5242e90..3fce6a0f1c 100644 --- a/modules/angular2/src/directives/class.ts +++ b/modules/angular2/src/directives/class.ts @@ -8,6 +8,28 @@ import {IterableChanges} from 'angular2/src/change_detection/pipes/iterable_chan import {isPresent, isString, StringWrapper} from 'angular2/src/facade/lang'; import {ListWrapper, StringMapWrapper, isListLikeIterable} from 'angular2/src/facade/collection'; +/** + * Adds and removes CSS classes based on an {expression} value. + * + * The result of expression is used to add and remove CSS classes using the following logic, + * based on expression's value type: + * - {string} - all the CSS classes (space - separated) are added + * - {Array} - all the CSS classes (Array elements) are added + * - {Object} - each key corresponds to a CSS class name while values + * are interpreted as {boolean} expression. If a given expression + * evaluates to {true} a corresponding CSS class is added - otherwise + * it is removed. + * + * # Example: + * + * ``` + *
+ * Please check errors. + *
+ * ``` + * + * @exportedAs angular2/directives + */ @Directive({selector: '[class]', lifecycle: [onCheck], properties: ['rawClass: class']}) export class CSSClass { _pipe: Pipe;