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

Popular posts from this blog

sidemenu refresh through events

push multiple data in array(select and disselect items in array)

How to Add Firebase Analytics to Your NativeScript Mobile App