Hello, I am new to the ionic world and every time I find new concepts and ways of doing things, the fact is that I have a list of objects that I bring from an API and I want to filter the results by word, basically what What I want is:
<ion-searchbar (ionInput)="getItems($event)" (ionCancel)="cancel($event)"
[ngModel]="busqueda"></ion-searchbar>
<ion-list>
<ion-item *ngFor="let item of items | filter="busqueda">
{{item.title}}
</ion-item>
</ion-list>
I have searched the web and tried some things but it does not work for me, I do not know how to implement it.
My home.ts is the following
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import {BqeProvider} from '../../providers/bqe/bqe';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
public items:any;
busqueda : string = "";
constructor(public navCtrl: NavController, public bqe:BqeProvider) {
}
ionViewDidLoad(){
this.InitializeItems();
}
InitializeItems(){
this.bqe.obtenerDatos().subscribe(
(respon) => {
//this.alquran = respon;
this.items = respon;
});
}
getItems(ev: any) {}
cancel(ev:any){
this.InitializeItems();
}
}