mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00

- add spacing between imports - alphabetize imports - removed app.html files in favor of an inline ion-nav - cleaned up config demo so it uses proper syntax - use file name main.html for the first page for the demo - name the app ApiDemoApp and first page ApiDemoPage - replace the ion-toolbars with ion-navbars closes #7019 closes driftyco/ionic-site#647
41 lines
776 B
TypeScript
41 lines
776 B
TypeScript
import { Component } from '@angular/core';
|
|
|
|
import { ionicBootstrap } from 'ionic-angular';
|
|
|
|
|
|
@Component({
|
|
templateUrl: 'main.html'
|
|
})
|
|
class ApiDemoPage {
|
|
items: Array<string>;
|
|
|
|
ngOnInit() {
|
|
this.setItems();
|
|
}
|
|
|
|
setItems() {
|
|
this.items = ['Orange', 'Banana', 'Pear', 'Tomato', 'Grape', 'Apple', 'Cherries', 'Cranberries', 'Raspberries', 'Strawberries', 'Watermelon'];
|
|
}
|
|
|
|
filterItems(ev) {
|
|
this.setItems();
|
|
let val = ev.target.value;
|
|
|
|
if (val && val.trim() !== '') {
|
|
this.items = this.items.filter(function(item) {
|
|
return item.toLowerCase().includes(val.toLowerCase());
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@Component({
|
|
template: '<ion-nav [root]="root"></ion-nav>'
|
|
})
|
|
class ApiDemoApp {
|
|
root = ApiDemoPage;
|
|
}
|
|
|
|
ionicBootstrap(ApiDemoApp);
|