diff --git a/aio/content/translations/cn/api-plan.md b/aio/content/translations/cn/api-plan.md index eb2dd24ace..5c0e9f6ebe 100644 --- a/aio/content/translations/cn/api-plan.md +++ b/aio/content/translations/cn/api-plan.md @@ -12,7 +12,7 @@ [x] |core/NgModule | 4,097 | 1.27 [x] |router/Router | 4,049 | 1.26 [ ] |animations/animate | 3,817 | 1.19 -[ ] |common/NgClass | 3,715 | 1.15 +[x] |common/NgClass | 3,715 | 1.15 [ ] |common/DatePipe | 3,576 | 1.11 [ ] |forms/FormsModule | 3,381 | 1.05 [x] |core/Input | 3,354 | 1.04 diff --git a/packages/common/src/directives/ng_class.ts b/packages/common/src/directives/ng_class.ts index a8260a7f5d..a83a55f1bd 100644 --- a/packages/common/src/directives/ng_class.ts +++ b/packages/common/src/directives/ng_class.ts @@ -28,12 +28,24 @@ import {Directive, DoCheck, ElementRef, Input, IterableChanges, IterableDiffer, * * Adds and removes CSS classes on an HTML element. * + * 从 HTML 元素上添加和移除 CSS 类。 + * * The CSS classes are updated as follows, depending on the type of the expression evaluation: + * + * CSS 类会根据表达式求值结果进行更新,更新逻辑取决于结果的类型: + * * - `string` - the CSS classes listed in the string (space delimited) are added, + * + * `string` - 会把列在字符串中的 CSS 类(空格分隔)添加进来, + * * - `Array` - the CSS classes declared as Array elements are added, + * + * `Array` - 会把数组中的各个元素作为 CSS 类添加进来, + * * - `Object` - keys are CSS classes that get added when the expression given in the value * evaluates to a truthy value, otherwise they are removed. * + * `Object` - 每个 key 都是要处理的 CSS 类,当表达式求值为真的时候则添加,为假则移除。 * */ @Directive({selector: '[ngClass]'})