-1

So I was following this post access key and value of object using *ngFor

However I'm getting a 'pipe could not be found error'.

  • I've done this @Pipe({name: 'keys'})

  • I've exported the class.

  • I've imported it in my app.module.ts

  • I've put it in the declarations

  • I've included it in my app.component.ts (where I'm using it)

What else am I missing?

Community
  • 1
  • 1
A. L
  • 11,695
  • 23
  • 85
  • 163

2 Answers2

2

Create pipe using below command: ng g p double

if you are using angular2 cli then only you need to add filter like `{{ mytext | double }} in your template html.

There is no need to add file in your component but check the pipe should be included in app.module.ts @NgModule({declarations: [DoublePipe]}) .

him
  • 3,325
  • 3
  • 14
  • 17
0

Have you put it in your AppModule's providers list?

Harry Ninh
  • 16,288
  • 5
  • 60
  • 54
  • It works now for some reason... should it be in `declarations` or `providers`? Because it's in declarations right now and it works. Maybe I just didn't let it update... there seems to be a caching issue with Angular 2, where it won't display updates unless you delete the cache. – A. L Dec 11 '16 at 22:57