mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Contrived router example
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {Routable, NavController, NavbarTemplate, Navbar, NavPush, Content} from 'ionic/ionic';
|
||||
import {Routable, Router, NavController, NavbarTemplate, Navbar, NavPush, Content} from 'ionic/ionic';
|
||||
import {SecondPage} from './second-page';
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ export class FirstPage {
|
||||
this.nav = nav;
|
||||
this.val = Math.round(Math.random() * 8999) + 1000;
|
||||
|
||||
FirstPage.router.invoke(this);
|
||||
this.router = FirstPage.router.invoke(this);
|
||||
|
||||
this.pushPage = SecondPage;
|
||||
this.pushData = {
|
||||
@@ -53,6 +53,7 @@ export class FirstPage {
|
||||
|
||||
viewDidEnter() {
|
||||
console.log('viewDidEnter first page');
|
||||
Router.emit(this.router.routeInfo.url);
|
||||
}
|
||||
|
||||
viewWillLeave() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
import {Routable, NavController, NavPop, NavParams, NavbarTemplate, Navbar, Content} from 'ionic/ionic';
|
||||
import {Routable, Router, NavController, NavPop, NavParams, NavbarTemplate, Navbar, Content} from 'ionic/ionic';
|
||||
import {ThirdPage} from './third-page';
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ export class SecondPage {
|
||||
this.params = params;
|
||||
this.val = Math.round(Math.random() * 8999) + 1000;
|
||||
|
||||
SecondPage.router.invoke(this);
|
||||
this.router = SecondPage.router.invoke(this);
|
||||
|
||||
console.log('Second page params:', params);
|
||||
}
|
||||
@@ -59,6 +59,7 @@ export class SecondPage {
|
||||
|
||||
viewDidEnter() {
|
||||
console.log('viewDidEnter second page');
|
||||
Router.emit(this.router.routeInfo.url);
|
||||
}
|
||||
|
||||
viewWillLeave() {
|
||||
|
||||
Reference in New Issue
Block a user