The built-in pipe is work,but all custom pipes that i wanna use are the same error:
the pipe 'actStatusPipe' could not be found
[ERROR ->]{{data.actStatus | actStatusPipe}}
I have tried two ways,declare it in app.module's declarations:
app.module.ts:
import {ActStatusPipe} from '../pipe/actPipe' @NgModule({ declarations: [ AppComponent, HomePage, ActivitiesList, ActStatusPipe ], ... }) or use other module to declare and export all my pipes: //pipe
import {ActStatusPipe} from "./actPipe" @NgModule({ declarations:[ActStatusPipe], imports:[CommonModule], exports:[ActStatusPipe] }) export class MainPipe{} and import it in app.module.
//pipe import {MainPipe} from '../pipe/pipe.module' @NgModule({ declarations:[...], imports:[...,MainPipe], }) But none of them work in my app.
Here is my code of the pipe:
import {Pipe,PipeTransform} from "@angular/core"; @Pipe({ name:'actStatusPipe' }) export class ActStatusPipe implements PipeTransform{ transform(status:any):any{ switch (status) { case 1: return "UN_PUBLISH"; case 2: return "PUBLISH"; default: return status } } } I think it is most of the same with the document(In fact,i have just copied from the document and made a little modification)
And my angular2's version is 2.1.
Lots of solution that can be searched in stackOverflow and google are tried in my app,however they don't work.
This confused me a lot,thanks for you answer!