import {Component} from 'angular2/angular2';
import {App, NavController} from 'ionic/ionic';
import {Page, Config, IonicApp} from 'ionic/ionic';
import {NavParams, NavController, ViewController, IONIC_DIRECTIVES} from 'ionic/ionic';
@Component({
selector: 'my-cmp',
template: `
My Custom Component Test
`,
directives: [IONIC_DIRECTIVES]
})
class MyCmpTest{}
@Page({
template: `
{{title}}
{{title}}
`,
directives: [MyCmpTest]
})
class FirstPage {
constructor(
nav: NavController,
app: IonicApp,
config: Config
) {
this.nav = nav;
this.title = 'First Page';
this.pushPage = FullPage;
this.pages = [];
for (var i = 1; i <= 50; i++) {
this.pages.push(i);
}
}
setViews() {
let items = [
PrimaryHeaderPage
];
this.nav.setViews(items);
}
pushPrimaryHeaderPage() {
this.nav.push(PrimaryHeaderPage);
}
pushFullPage() {
this.nav.push(FullPage, { id: 8675309, myData: [1,2,3,4] } );
}
pushAnother() {
this.nav.push(AnotherPage);
}
}
@Page({
template: `
Full page
This page does not have a nav bar!
`
})
class FullPage {
constructor(
nav: NavController,
params: NavParams
) {
this.nav = nav;
this.params = params;
}
setViews() {
let items = [
FirstPage,
PrimaryHeaderPage
];
this.nav.setViews(items);
}
pushPrimaryHeaderPage() {
this.nav.push(PrimaryHeaderPage);
}
pushAnother() {
this.nav.push(AnotherPage);
}
pushFirstPage() {
this.nav.push(FirstPage);
}
}
@Page({
template: `
Primary Color Page Header
`
})
class PrimaryHeaderPage {
constructor(
nav: NavController
) {
this.nav = nav
}
pushAnother() {
this.nav.push(AnotherPage);
}
pushFullPage() {
this.nav.push(FullPage, { id: 8675309, myData: [1,2,3,4] } );
}
insert() {
this.nav.insert(FirstPage, 2);
}
removeSecond() {
this.nav.remove(1);
}
}
@Page({
template: `
Another Page Header
Back button hidden w/ ion-navbar hide-back-button
`
})
class AnotherPage {
constructor(
nav: NavController,
viewCtrl: ViewController
) {
this.nav = nav;
this.viewCtrl = viewCtrl;
this.bbHideToggleVal = true;
}
pushFullPage() {
this.nav.push(FullPage);
}
pushPrimaryHeaderPage() {
this.nav.push(PrimaryHeaderPage);
}
pushFirstPage() {
this.nav.push(FirstPage);
}
toggleBackButton() {
this.bbHideToggleVal = !this.bbHideToggleVal
this.viewCtrl.hideBackButton(this.bbHideToggleVal);
}
}
@App({
pages: [FirstPage, FullPage, PrimaryHeaderPage, AnotherPage],
template: ``
})
class E2EApp {
constructor() {
this.root = FirstPage;
}
}