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

how to split array as per fixed length, and ionic two dates differences in min,seconds,hours

How to Add Firebase Analytics to Your NativeScript Mobile App