简体   繁体   中英

Angular2 module component giving me error pipe can not be found

Angular2 module component giving me error pipe can not be found

{{obj|json}}

pipe json can not be found. What is the possible reason for the error?

Below is the test code and it simply works :

app.component.ts

import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {

  obj : any = ['test1', 'test2', 'test3'];

} 

app.component.html

{{ obj |  json }}

browser output

[ "test1", "test2", "test3" ]

You can paste the code here, so that we can check where exactly you are missing on pipe.

You can check more information on Jsonpipe here

https://angular.io/api/common/JsonPipe

在我的情况下,它只是重新启动应用程序并且它起作用了。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM