2016-06-23 12:47:54 -04:00
|
|
|
/**
|
|
|
|
* @license
|
2020-05-19 15:08:49 -04:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2016-06-23 12:47:54 -04:00
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-09-27 20:12:25 -04:00
|
|
|
import {Component} from '@angular/core';
|
2015-11-02 18:46:59 -05:00
|
|
|
|
|
|
|
// #docregion JsonPipe
|
|
|
|
@Component({
|
2016-09-09 00:41:09 -04:00
|
|
|
selector: 'json-pipe',
|
2015-11-02 18:46:59 -05:00
|
|
|
template: `<div>
|
|
|
|
<p>Without JSON pipe:</p>
|
|
|
|
<pre>{{object}}</pre>
|
|
|
|
<p>With JSON pipe:</p>
|
|
|
|
<pre>{{object | json}}</pre>
|
|
|
|
</div>`
|
|
|
|
})
|
2016-09-09 00:41:09 -04:00
|
|
|
export class JsonPipeComponent {
|
2016-05-26 16:33:53 -04:00
|
|
|
object: Object = {foo: 'bar', baz: 'qux', nested: {xyz: 3, numbers: [1, 2, 3, 4, 5]}};
|
2015-11-02 18:46:59 -05:00
|
|
|
}
|
|
|
|
// #enddocregion
|