From a510ed5312c0563b67754d889508a122289eb9f5 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Tue, 4 Sep 2018 14:54:23 +0800 Subject: [PATCH] =?UTF-8?q?docs(API):=20=E7=BF=BB=E8=AF=91=E5=AE=8C?= =?UTF-8?q?=E4=BA=86=20JsonPipe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/content/translations/cn/api-plan.md | 2 +- packages/common/src/pipes/json_pipe.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/aio/content/translations/cn/api-plan.md b/aio/content/translations/cn/api-plan.md index e6892037d4..70e5bb2c88 100644 --- a/aio/content/translations/cn/api-plan.md +++ b/aio/content/translations/cn/api-plan.md @@ -62,7 +62,7 @@ [ ] | animations/style | 0.25 [x] | common/SlicePipe | 0.25 [ ] | router/Event | 0.25 -[ ] | common/JsonPipe | 0.25 +[x] | common/JsonPipe | 0.25 [x] | forms/FormArray | 0.25 [ ] | common/CommonModule | 0.24 [ ] | router/NavigationExtras | 0.24 diff --git a/packages/common/src/pipes/json_pipe.ts b/packages/common/src/pipes/json_pipe.ts index c0c2d81ee9..b6063fa4cd 100644 --- a/packages/common/src/pipes/json_pipe.ts +++ b/packages/common/src/pipes/json_pipe.ts @@ -14,10 +14,14 @@ import {Pipe, PipeTransform} from '@angular/core'; * * Converts a value into its JSON-format representation. Useful for debugging. * + * 把一个值转换成 JSON 字符串格式。在调试时很有用。 + * * @usageNotes * * The following component uses a JSON pipe to convert an object * to JSON format, and displays the string in both formats for comparison. + * + * 下列组件使用了一个 `JSON` 管道来把对象转换成 JSON 格式,并以两种格式显示字符串供对比。 * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'} * @@ -27,6 +31,8 @@ import {Pipe, PipeTransform} from '@angular/core'; export class JsonPipe implements PipeTransform { /** * @param value A value of any type to convert into a JSON-format string. + * + * 任何类型的要转换成 JSON 字符串格式的值 */ transform(value: any): string { return JSON.stringify(value, null, 2); } }