Angular 4 template "Pipe could not be found"

Viewed 20002

I'm trying to use a custom-built pipe in my Angular 4 project. Can't figure out why the compiler doesn't recognize my pipe in the component template.

QFormat pipe

@Pipe({  name: 'qFormat'})
export class QFormatPipe implements PipeTransform {...}

SharedModule

@NgModule({
    declarations: [QFormatPipe],
    exports: [QFormatPipe]
})
export class SharedModule { }

FeatureModule

@NgModule({
  imports: [SharedModule],
  declarations: [MyComponent]
})
export class FeatureModule{ }

MyComponent.html

<div>{{someProp | qformat}}</div>
                  ^^^^^^^

The template throws error:

Angular: the pipe 'qformat' could not be found

Am I missing something?

3 Answers

mine was as simple as just forgetting to register it to my @NgModule

Related