Angular 2.0 translate Pipe could not be found
You need to imports: [ TranslateModule ]
into whatever module the BookingComponent
is declare in. The import in the app module only makes the pipes available to components declared in that module. But providers/services are globally registered from the module (unlike components, directives, and pipes)
For those coming across this, here are the steps you need to do in a nutshell to fix the issue
- Have the translate module logic along with translate loader and translateFactory present in the app.module.ts
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (http: Http) =>
new TranslateStaticLoader(http, './assets/i18n', '.json'),
deps: [Http]
})
],`
- In your shared.module.ts (or any other module), import and export the Translate module.
i.e.: Translate module should be a part of both the import and export arrays. Most answers in SO and github mention importing the module but not exporting it.
@NgModule({
imports: [
// other imported modules here
TranslateModule
],
exports: [
// other exported modules here
TranslateModule]`