import {App, Page, NavController} from 'ionic-angular'; @Page({ templateUrl: 'first.html' }) class FirstPage { constructor(private _nav: NavController) { } goToSecond() { this._nav.push(SecondPage); } } @Page({ templateUrl: 'second.html' }) class SecondPage { constructor() { this.searchQuery = ''; 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; }) } } @App({ template: '' }) class E2EApp { constructor() { this.root = FirstPage; } }