Search code examples
angulartypescriptionic-frameworkionic3ionic4

pipe ' ' could not be found in case of modal page


I have a pipe in folder app/pipes/safepipe.

If I call this pipe in app/home, it works.

Note: I have imported and declared it in home.module.ts

If I don't use this pipe onhome page and try to use in a page created at app/modals/viewdreportmodal, I get error

Note: I am using this modal page on home page.

The pipe 'safe2' could not be found ("
    <ion-text>
      {{daily_report_desc }}
      <span [innerHtml]="[ERROR ->]daily_report_desc | safe2: 'html'">{{daily_report_desc}}</span>
      </ion-text>
    <ion-text>
"): ng:///HomePageModule/ViewdreportmodalPage.html@17:25

I can't figure out why the compiler doesn't recognize my pipe in the modal page.


Solution

  • Option 1 -You have to import the pipe in app.module.ts or the module that is inside app/modals.

    Option 2- you can export the home module and import it in module inside app/modals.

    In home.module.ts just like the img below export your pipe and in viewdreportmodal.module.ts import your home module

    In home.module.ts  just like the img below export your pipe and in viewdreportmodal.module.ts import your home module