JsonPipe
Stable Pipe
Что это делает
Преобразует значение в JSON-строку.
Как использовать
expression | json
NgModule
CommonModuleОписание
Преобразует значение в строку с помощью JSON.stringify. Полезно для отладки.
Пример
@Component({
selector: 'json-pipe',
template: `<div>
<p>Without JSON pipe:</p>
<pre>{{object}}</pre>
<p>With JSON pipe:</p>
<pre>{{object | json}}</pre>
</div>`
})
export class JsonPipeComponent {
object: Object = {foo: 'bar', baz: 'qux', nested: {xyz: 3, numbers: [1, 2, 3, 4, 5]}};
}
экспортировано из @angular/common/index определено в @angular/common/src/pipes/json_pipe.ts
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/common/index/JsonPipe-pipe.html