How to filter just the name of the Object on Ionic?


I’ve got a problem. I have a list of cities, but when I use the search-bar, I just want the cities with the same name to appear.

Currently i’m trying this:


  <ion-item *ngFor="let city of cities | orderBy: name | filter: selectedCity">
    <button (click)="onActive(" *ngIf="" ion-button outline item-right>Desativar</button>
    <button (click)="onActive(" *ngIf="!" ion-button outline item-right>Ativar</button>

But I know it will never works 'cause i’m sending the object city to the pipe ‘filter’ and not the name, how can I send just the name for the pipe? I need the object for the method ‘onActive’

The Pipe:

name: "filter",
pure: false

export class FilterArrayPipe implements PipeTransform {

transform(items: Array<any>, conditions: {[field: string]: any}): Array<any> {
    return items.filter(item => {
        for (let field in conditions) {
            if (item[field] !== conditions[field]) {
                return false;
        return true;

And ‘selectedCity’ is a String. When I try the pipe out with others strings, It works. Another point, I need to filter comparing the name of the object but I need the whole object after this.