Getting error when i'm using pipe in multipe module

I have created a PIPE(truncate.pipe.ts) for limiting string value. If i use that pipe in a single module it’s working but when i use it in multiple module it is showing error.

My error is:

Error: Type TruncatePipe is part of the declarations of 2 modules: ListPageModule and ListItemDetailPageModule! Please consider moving TruncatePipe to a higher module that imports ListPageModule and ListItemDetailPageModule. You can also create a new NgModule that exports and includes TruncatePipe then import that NgModule in ListPageModule and ListItemDetailPageModule.

You have two options, and I’ll try to fake being neutral about which I’d choose.

A. Put TruncatePipe in its own module, declare it, export it, and then include that module in both the modules of the other pages.

B. Put TruncatePipe in the main AppModule.

1 Like