'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.
Solution 1:[1]
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!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mahdi Zarei |