docs(API): 翻译完了 JsonPipe

This commit is contained in:
Zhicheng Wang 2018-09-04 14:54:23 +08:00
parent adb6be6a02
commit a510ed5312
2 changed files with 7 additions and 1 deletions

View File

@ -62,7 +62,7 @@
[ ] | animations/style | 0.25 [ ] | animations/style | 0.25
[x] | common/SlicePipe | 0.25 [x] | common/SlicePipe | 0.25
[ ] | router/Event | 0.25 [ ] | router/Event | 0.25
[ ] | common/JsonPipe | 0.25 [x] | common/JsonPipe | 0.25
[x] | forms/FormArray | 0.25 [x] | forms/FormArray | 0.25
[ ] | common/CommonModule | 0.24 [ ] | common/CommonModule | 0.24
[ ] | router/NavigationExtras | 0.24 [ ] | router/NavigationExtras | 0.24

View File

@ -14,10 +14,14 @@ import {Pipe, PipeTransform} from '@angular/core';
* *
* Converts a value into its JSON-format representation. Useful for debugging. * Converts a value into its JSON-format representation. Useful for debugging.
* *
* JSON
*
* @usageNotes * @usageNotes
* *
* The following component uses a JSON pipe to convert an object * The following component uses a JSON pipe to convert an object
* to JSON format, and displays the string in both formats for comparison. * to JSON format, and displays the string in both formats for comparison.
*
* 使 `JSON` JSON
* {@example common/pipes/ts/json_pipe.ts region='JsonPipe'} * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
* *
@ -27,6 +31,8 @@ import {Pipe, PipeTransform} from '@angular/core';
export class JsonPipe implements PipeTransform { export class JsonPipe implements PipeTransform {
/** /**
* @param value A value of any type to convert into a JSON-format string. * @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); } transform(value: any): string { return JSON.stringify(value, null, 2); }
} }