From 7c7733c3af4511f7c6c96e65f565ced4109e952a Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Wed, 5 Sep 2018 09:15:35 +0800 Subject: [PATCH] =?UTF-8?q?docs(API):=20=E7=BF=BB=E8=AF=91=E5=AE=8C?= =?UTF-8?q?=E4=BA=86=20PipeTransform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/content/translations/cn/api-plan.md | 2 +- packages/core/src/change_detection/pipe_transform.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/aio/content/translations/cn/api-plan.md b/aio/content/translations/cn/api-plan.md index 745c9e63fd..e4cadc4cfd 100644 --- a/aio/content/translations/cn/api-plan.md +++ b/aio/content/translations/cn/api-plan.md @@ -90,7 +90,7 @@ [x] | forms/ReactiveFormsModule | 0.18 [x] | common/http/HTTP_INTERCEPTORS | 0.18 [x] | platform-browser/DomSanitizer | 0.18 -[ ] | core/PipeTransform | 0.18 +[x] | core/PipeTransform | 0.18 [ ] | core/SimpleChange | 0.18 [ ] | core/SimpleChanges | 0.18 [ ] | forms/NgSelectOption | 0.17 diff --git a/packages/core/src/change_detection/pipe_transform.ts b/packages/core/src/change_detection/pipe_transform.ts index 740581d6ac..4e9430d655 100644 --- a/packages/core/src/change_detection/pipe_transform.ts +++ b/packages/core/src/change_detection/pipe_transform.ts @@ -9,14 +9,22 @@ /** * To create a Pipe, you must implement this interface. * + * 要创建一个管道,你必须实现该接口。 + * * Angular invokes the `transform` method with the value of a binding * as the first argument, and any parameters as the second argument in list form. * + * Angular 会调用它的 `transform` 方法,并把要绑定的值作为第一个参数传入,其它参数会依次从第二个参数的位置开始传入。 + * * @usageNotes * ### Example * + * ### 例子 + * * The `RepeatPipe` below repeats the value as many times as indicated by the first argument: * + * 下面的 `RepeatPipe` 会把第一个参数指定的值(`value`)重复很多次(`times`): + * * ``` * import {Pipe, PipeTransform} from '@angular/core'; * @@ -30,6 +38,7 @@ * * Invoking `{{ 'ok' | repeat:3 }}` in a template produces `okokok`. * + * 在模板中调用 `{{ 'ok' | repeat:3 }}` 的结果是 `okokok`。 * */ export interface PipeTransform { transform(value: any, ...args: any[]): any; }