I am updating my application to use the module structure, and I ran into some strange problem while trying to add my pipe component to the general module. From what I read, everything is set up correctly for me, so I must be missing nothing.
Error: Unhandled Promise rejection: Template parse errors: The pipe 'cmgTitleize' could not be found
I have BrowseModulethis module declare ProjectCardComponentwhich has a template that uses a pipe cmgTitleize. To provide access to TitleizePipe, I import my own SharedModule.
@NgModule({
declarations: [
...,
ProjectCardComponent
],
imports: [
...,
SharedModule
],
providers: [
...
]
})
export class BrowseModule { }
SharedModuleimports PipesModule:
@NgModule({
declarations: [
...
],
exports: [
...
],
imports: [
...,
PipesModule
]
})
export class SharedModule { }
PipesModuledeclares and exports TitelizePipe:
@NgModule({
declarations: [
...
TitleizePipe
],
exports: [
...
TitleizePipe
]
})
export class PipesModule { }
Finally, a TitleizePipe is used to test sanity:
@Pipe({
name: 'cmgTitleize'
})
export class TitleizePipe implements PipeTransform {
...
}
source
share