title: How to do auto-complete in ionic 2 (search-bar)
body: <p>I am trying to do an auto complete in my search bar what i have done so far is.</p>
  
  <p>I have an array with some strings. and then i am trying to list in my items it i am able to search the particualr item.</p>
  
  <p>But my requirement is not to display the items in a list. I have to make on clicking the search bar all the strings in array should come and the i have to make a search.</p>
  
  <pre><code>&lt;ion-header&gt;
  
    &lt;ion-navbar&gt;
      &lt;ion-title&gt;search&lt;/ion-title&gt;
    &lt;/ion-navbar&gt;
    &lt;ion-toolbar primary &gt;
      &lt;ion-searchbar (ionInput)="getItems($event)" autocorrect="off"&gt;&lt;/ion-searchbar&gt;
    &lt;/ion-toolbar&gt;
  
  &lt;/ion-header&gt;
  
  
  &lt;ion-content padding&gt;
  
  &lt;ion-list&gt;
    &lt;ion-item *ngFor="let item of items"&gt;
      {{ item }}
    &lt;/ion-item&gt;
  &lt;/ion-list&gt;  
  
  &lt;/ion-content&gt;
  </code></pre>
  
  <p>Code for search.ts file:</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { NavController } from 'ionic-angular';
  
  /*
    Generated class for the SearchPage page.
  
    See http://ionicframework.com/docs/v2/components/#navigation for more info on
    Ionic pages and navigation.
  */
  @Component({
    templateUrl: 'build/pages/search/search.html',
  })
  export class SearchPage {
  private searchQuery: string = '';
    private items: string[];
  
    constructor(private navCtrl: NavController) {
      this.initializeItems();
    }
  
    initializeItems() {
      this.items = [
        'Amsterdam',
        'Bogota',
      ]
    }
  
    getItems(ev: any) {
      // Reset items back to all of the items
      this.initializeItems();
  
      // set val to the value of the searchbar
      let val = ev.target.value;
  
      // if the value is an empty string don't filter the items
      if (val &amp;&amp; val.trim() != '') {
        this.items = this.items.filter((item) =&gt; {
          return (item.toLowerCase().indexOf(val.toLowerCase()) &gt; -1);
        })
      }
    }
  }
  </code></pre>
  
  <p><strong>Question :</strong></p>
  
  <blockquote>
    <p>How to get the value of an array through auto complete in ionic 2.</p>
  </blockquote>