title: angular input search field on an array of objects
body: <p>hey I'm new to angular and I have a problem 
  I have an array of objects :</p>
  
  <pre><code>holders: Holder[] = [
    { name: 'hanna', nationalId: 310, customerNumber: '123' },
    { name: 'jack', nationalId: 320, customerNumber: '124' },
    { name: 'sara', nationalId: 320, customerNumber: '125' },
  ];
  </code></pre>
  
  <p>in my search field I enter the customerNumber and if the holder exist it's name will be displayed under the field and if not it will display an error (the holder does not exist)
  the component :</p>
  
  <pre><code>constructor(private holderService: HolderService) {
     this.holderService.searchfunc(this.searchTerm$)
         .subscribe(results =&gt; {
             this.result = results;
         });
  }
  searchHolder(term: string): void {
     this.searchTerm$.next(term);
  }
  </code></pre>
  
  <p>and the service:</p>
  
  <pre><code>searchfunc(terms: Observable&lt;string&gt;) {
     return terms.pipe(
         debounceTime(500),
         distinctUntilChanged(),
         map(term =&gt; this.searchEntries(term)));
  }
  searchEntries(term) {
     if(term){
         this.searchResult = this.holders.filter(x =&gt; x.customerNumber === term);
         if(this.searchResult[0]){
             return this.searchResult[0].name;
         }else{
             return 'the holder does not exist';
         }
     }else{
         this.search = term;
     }
  }
  </code></pre>
  
  <p>is there any solution to do it in a better way? and I wanna handle the existence of holder in the component rather than in the service</p>