mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
70 lines
1.2 KiB
TypeScript
70 lines
1.2 KiB
TypeScript
import {Page} from 'ionic/ionic';
|
|
import {forwardRef} from 'angular2/angular2';
|
|
import {AndroidAttribute} from '../../helpers';
|
|
|
|
@Page({
|
|
templateUrl: 'inputs/search/template.html',
|
|
directives: [forwardRef(() => AndroidAttribute)]
|
|
})
|
|
export class SearchPage{
|
|
constructor() {
|
|
this.searchQuery = '';
|
|
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() {
|
|
var q = this.searchQuery;
|
|
if(q.trim() == '') {
|
|
return this.items;
|
|
}
|
|
return this.items.filter((v) => {
|
|
if(v.toLowerCase().indexOf(q.toLowerCase()) >= 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
})
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|