Q:

PipeTransform is not working ionic2

and I have some item to change words

example : lang->language

I want to ion-option to show all items with the first letter in uppercase

example : author->Author

example
author        Author
lang          Language
date          Date
loca          Location

mycode
<ion-select [(ngModel)]="refine" (ionChange)="optionsFn(item, i);" >
        <ion-option [value]="item"  *ngFor="let item of totalfilter | mypipe;let i = index" >{{item["@NAME"]}}</ion-option>
      </ion-select>

mypipe.ts
       import { Pipe, PipeTransform } from '@angular/core';

    @Pipe({
        name: 'mypipe', pure: false
    })
    export class MyPipe implements PipeTransform {
  public posts;
public post;
      transform(items: any[]): any[] {
          if (items && items.length)
            this.posts = items.filter(it => it["@NAME"] =  it["@NAME"].replace('lang','language'));
            this.post = this.posts.filter(it => it["@NAME"] = it["@NAME"].charAt(0).toUpperCase()+ it["@NAME"].slice(1))

          return this.post;
        }

    }

is not working and error is

Cannot read property 'filter' of undefined

A:

Do this:
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
    name: 'mypipe', pure: false
})
export class MyPipe implements PipeTransform {

    transform(items: any[]): any[] {
        if (items && items.length)
          return items.filter(it => it["@NAME"] = it["@NAME"].charAt(0).toUpperCase() + it["@NAME"].slice(1));
        return items;  
    }

}

