ionic5search
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
/*
Generated class for the DataProvider provider.
See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable({
providedIn: 'root'
})
export class DataService{
items:{firstname:any,lastname:any}[]=[];
constructor(public http: HttpClient) {
console.log('Hello DataProvider Provider');
}
getplist(list:any){
list.map(data=>{
this.items.push(data);
});
}
filterItems(searchTerm) {
console.log(searchTerm)
return this.items.filter((item) => {
return item.firstname?item.firstname.toLowerCase().indexOf(searchTerm.toLowerCase()) > -1:'';
});
}
}
Comments
Post a Comment