Vishnu S Kumar
Vishnu S Kumar

Reputation: 686

Currency Pipe not found error inside the ionic 5 component

I'm using a currency pipe inside my page module without any issues. However, it shows a 'not found error' when using it inside a modal component.

example usage:

{{50| currency: 'INR'}}

Error :

ERROR Error: Uncaught (in promise): Error: The pipe 'currency' could not be found!
Error: The pipe 'currency' could not be found!
at getPipeDef$1 (core.js:36858)
at ɵɵpipe (core.js:36816)
at SearchComponent_Template (template.html:30)
at executeTemplate (core.js:12156)

Environment:

   Ionic CLI                     : 5.4.16         
   Ionic Framework               : @ionic/angular 5.1.1
   @angular-devkit/build-angular : 0.901.7
   @angular-devkit/schematics    : 9.1.7
   @angular/cli                  : 9.1.7
   @ionic/angular-toolkit        : 2.2.0

The same code is working in the page but fails in the component. Any lights into this issue is highly appreciated.

Upvotes: 1

Views: 877

Answers (1)

Mahdi Zarei
Mahdi Zarei

Reputation: 7456

modals are components, not pages. make a [modal-name].module.ts file in your modal directory using:

ionic g module [modal-name]

and import your pipe there.

then you can import it in .ts file and use it with no error. Good Luck!

Upvotes: 2

Related Questions