Angular 2 - Import pipe locally
<p><strong>THE SITUATION:</strong></p>

<p>I need to use a pipe in only one component. For this reason i didn't wanted to import it globally but only in the component.</p>

<p>I have tried looking for reference on how to do it but couldn't find it.</p>

<p>This is my attempt:</p>

<p><strong>THE PIPE:</strong></p>

<p>when tested globally is working fine</p>

<pre><code>import { Pipe, PipeTransform } from '@angular/core';

@Pipe({name: 'keys'})
export class KeysPipe implements PipeTransform {
    transform(value, args:string[]) : any 
    {
        let keys = [];      
        for (let key in value) 
        {
            keys.push({key: key, value: value[key]});
        }
        return keys;
    }
}
</code></pre>

<p><strong>THE COMPONENT</strong>:</p>

<pre><code>import { Component, NgModule } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import {CommonModule} from "@angular/common";

import { KeysPipe } from './keys.pipe';


@Component({
  selector: 'page-attendees',
  templateUrl: 'attendees.html'
})

@NgModule({
  declarations: [ KeysPipe ],
  imports: [ CommonModule ],
  exports: [ KeysPipe ]
})

export class AttendeesPage {

    public attendeeList = [];
    public arrayOfKeys;

    constructor(
        public navCtrl: NavController,
        public navParams: NavParams
    ) {
        this.attendeeList = this.navParams.get('attendeeList');
        this.arrayOfKeys = Object.keys(this.attendeeList);
    }

    ionViewDidLoad() {
        console.log('AttendeesPage');
    }
}
</code></pre>

<p><strong>THE ERROR:</strong></p>

<pre><code>Unhandled Promise rejection: Template parse errors:
The pipe 'keys' could not be found
</code></pre>

<p><a href="https://i.stack.imgur.com/hDzWT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hDzWT.png" alt="enter image description here"></a></p>

<p><strong>PLUNKER:</strong></p>

<p><a href="https://plnkr.co/edit/YJUHmAkhAMNki2i6A9VY?p=preview" rel="nofollow noreferrer">https://plnkr.co/edit/YJUHmAkhAMNki2i6A9VY?p=preview</a></p>

<p><strong>THE QUESTION:</strong></p>

<p>Do you know what I am doing wrong or if I am missing something?</p>

<p>Thanks!</p>