Search bar example for below code?

this.http.get(values).map(res => res.json()).subscribe(data => {

      this.customers = data;


      console.log(data);

    }, (err) => {
      console.log(err);

    });

and maybe you can describe what you want in some sentences?

ngOnInit() {
    this.getCustomers()
  }

  getCustomers() {
    let values = sessionStorage.getItem('url') + '/api/CustomerLocations?' + 'BusinessUnitId=' + this.BusinessUnitId;
    this.http.get(values).map(res => res.json()).subscribe(data => {
      
      this.customers = data;
      console.log(data);

    }, (err) => {
      console.log(err);

    });

  }


  initializeItems() {
    this.customers;

  }
  initialize() {

    this.items = this.customers;
  }
  getItems(ev: any) {



    let val = ev.target.value;
    alert(val)
    if (ev.target.value === "" || val === undefined) {
      this.initialize();
    }

    if (val && val.trim() != '') {
      this.customers = this.customers.filter((item) => {


        return (item.CustomerName.toLowerCase().indexOf(val.toLowerCase()) > 1);
      })
    }
  }

I meant with “some sentences” some words real text about your problem, what do you want to know exactly and so… like a forum works.

Nobody will look at bad formatted source code without to know, what it mean…

But:
a really good example how to achieve a searchfield with observables and some advantages of them, like only informing you if the text really changes and with a debounce time:

you should read over the article.

At the end you can shrink everythinf together like this:

// listen on value changes of your input
this.term.valueChanges
         // only check it if value does not changed in 400ms
         .debounceTime(400)
         // only go further if the value has really changed
         .distinctUntilChanged()
         // transform original observable to your api-call and not 
         .flatMap(term => this.wikipediaService.search(term))
         // grab the results
         .subscribe(items => this.items = items);

There are many helpful observable functions like last to only take last results.