Lazy loading in Ionic 3 is achieved using IonicPage
and IonicPageModule
, but unfortunately, lazy loaded pages do not have access to pipes.
Failed to navigate: Template parse errors:
The pipe 'myPipe' could not be found ("")
This question addresses the issue and offers a solution. However, the suggested solution involves importing the shared module pipes.module
in every lazy loaded page.
This seems like a step back from Angular 2's feature of importing pipes only once in the app.module.ts
.
It would be ideal to find a better way by importing the shared module pipes.module
in the app.module
so that all pages can access the pipes.
Below is the app.module.ts
:
@NgModule({
declarations: [
MyApp,
],
imports: [
BrowserModule,
HttpModule,
PipesModule,
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot()
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
],
providers: []
})
export class AppModule { }
Could we possibly use
PipesModule.forRoot(MyApp)
To ensure that the PipesModule
is accessible to all lazy loaded pages?
Here is the pipes.moudle.ts
file:
@NgModule({
declarations: [
BreakLine,
Hashtag,
Translator
],
imports: [
],
exports: [
BreakLine,
Hashtag,
Translator
]
,
})
export class PipesModule {}