Search not innitializing


#1

Hei Yall
What am i doin wrong here;
The searchbar is not popin up the searched item.Am i missing something.Heres my code:

export class MyPage {

searchQuery: string = ‘’;
items;
constructor(public navCtrl: NavController,menu: MenuController,

{

this.initializeItems();

}
initializeItems() {
this.items = [
‘Amsterdam’,
‘Bogota’,
‘Buenos Aires’,
‘Cairo’,
‘Dhaka’,
‘Edinburgh’,
‘Geneva’,
‘Genoa’,
‘Glasglow’,
‘Hanoi’,
‘Hong Kong’,
‘Islamabad’,
‘Istanbul’,
‘Jakarta’,
‘Kiel’,
‘Kyoto’,
‘Le Havre’,
‘Lebanon’,
‘Lhasa’,
‘Lima’,
‘London’,
‘Los Angeles’,
‘Madrid’,
‘Manila’,
‘New York’,
‘Olympia’,
‘Oslo’,
‘Panama City’,
‘Peking’,
‘Philadelphia’,
‘San Francisco’,
‘Seoul’,
‘Taipeh’,
‘Tel Aviv’,
‘Tokio’,
‘Uelzen’,
‘Washington’
];

}
getItems(searchbar) {
// Reset items back to all of the items
this.initializeItems();

// set q to the value of the searchbar
var q = searchbar.value;

// if the value is an empty string don't filter the items
if (q.trim() == '') {
  return;
}

this.items = this.items.filter((v) => {
  if (v.toLowerCase().indexOf(q.toLowerCase()) > -1) {
    return true;
  }
  return false;
})

}

Then in the html page i did the following:

""Empty""
<ion-content> 
  <ion-avatar item-left>
    <img src="icons/icondefault.png">
  </ion-avatar>
  <h2>{{ item }}</h2>
</ion-item>

But search is not returning a searched item like in the demo app.