mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Routing
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
import {bootstrap} from 'angular2/angular2'
|
||||
import {bootstrap, onInit, QueryList} from 'angular2/angular2'
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
|
||||
import {Nav} from 'ionic/components/nav/nav';
|
||||
import {FirstPage} from './pages/first-page';
|
||||
import {Router} from 'ionic/routing/router';
|
||||
|
||||
|
||||
@Component({ selector: 'ion-app' })
|
||||
@Component({
|
||||
selector: 'ion-app',
|
||||
})
|
||||
@View({
|
||||
template: `
|
||||
<ion-nav [initial]="initial"></ion-nav>
|
||||
<ion-nav #nav [initial]="initial"></ion-nav>
|
||||
`,
|
||||
directives: [Nav]
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@ import {Component, Directive, onInit} from 'angular2/src/core/annotations_impl/a
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {Routable, Router, NavController, NavbarTemplate, Navbar, NavPush, Content} from 'ionic/ionic';
|
||||
import {IonicApp} from '../index';
|
||||
import {SecondPage} from './second-page';
|
||||
|
||||
@Component({
|
||||
@@ -34,6 +35,10 @@ export class FirstPage {
|
||||
constructor(
|
||||
nav: NavController
|
||||
) {
|
||||
|
||||
// TODO: Shouldn't have to do this
|
||||
Router.setNavController(nav);
|
||||
|
||||
this.nav = nav;
|
||||
this.val = Math.round(Math.random() * 8999) + 1000;
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ export class SecondPage {
|
||||
nav: NavController,
|
||||
params: NavParams
|
||||
) {
|
||||
// TODO: Shouldn't have to do this
|
||||
Router.setNavController(nav);
|
||||
|
||||
this.nav = nav;
|
||||
this.params = params;
|
||||
this.val = Math.round(Math.random() * 8999) + 1000;
|
||||
|
||||
Reference in New Issue
Block a user