ngbtypehead search multiple key values in the object array

 <input type="search" class="form-control" formControlName="Item" 
  [ngbTypeahead]="search_Itm" [inputFormatter]="input_formatter_Itm" [resultFormatter]="result_formatter_Itm"[editable]='false'  placeholder="Search.." >

  //auto search //
  input_formatter_Itm = (item: any) => item.itmName ;
  result_formatter_Itm = (item: any) => item.itmName ;

  search_Itm = (text$: Observable<string>) => text$.pipe(
    filter(term => term.length >= 1),
    map(term => this.Item_Code_.filter(item => new RegExp(term, 'mi').test(JSON.stringify(item))).slice(0, 10)),

Read more here:

Content Attribution

This content was originally published by ishad v at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: