No Provider for CustomPipe – angular 4

If you want to use pipe’s transform() method in component, you also need to add CustomPipe to module’s providers:

import  { CustomPipe } from '../pipes/custom.pipe';

...

@NgModule({
  imports:      [ .. ],
  declarations: [ CustomPipe ],
  exports:    [ CustomPipe ],
  providers:    [ CustomPipe ]
})
export class SharedModule { }

Leave a Comment