2016-04-29 00:50:03 +00:00
|
|
|
import {Injectable, PipeTransform, WrappedValue, Pipe} from '@angular/core';
|
|
|
|
|
import {Json} from '../../src/facade/lang';
|
|
|
|
|
|
2015-05-18 16:24:52 +00:00
|
|
|
|
|
|
|
|
/**
|
2015-11-02 23:46:59 +00:00
|
|
|
* Transforms any input value using `JSON.stringify`. Useful for debugging.
|
2015-05-18 16:24:52 +00:00
|
|
|
*
|
2015-10-19 14:37:32 +00:00
|
|
|
* ### Example
|
2015-11-02 23:46:59 +00:00
|
|
|
* {@example core/pipes/ts/json_pipe/json_pipe_example.ts region='JsonPipe'}
|
2015-05-18 16:24:52 +00:00
|
|
|
*/
|
2016-04-26 04:58:48 +00:00
|
|
|
/* @ts2dart_const */
|
2015-10-27 10:18:29 +00:00
|
|
|
@Pipe({name: 'json', pure: false})
|
2015-08-06 17:39:02 +00:00
|
|
|
@Injectable()
|
2015-08-12 19:04:54 +00:00
|
|
|
export class JsonPipe implements PipeTransform {
|
2016-04-22 22:33:32 +00:00
|
|
|
transform(value: any): string { return Json.stringify(value); }
|
2015-05-18 16:24:52 +00:00
|
|
|
}
|