mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
Routing emit
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||||
|
|
||||||
import {NavController, NavbarTemplate, Navbar, NavPush, Content} from 'ionic/ionic';
|
import {Routable, NavController, NavbarTemplate, Navbar, NavPush, Content} from 'ionic/ionic';
|
||||||
import {SecondPage} from './second-page';
|
import {SecondPage} from './second-page';
|
||||||
|
|
||||||
|
|
||||||
@ -35,6 +35,8 @@ export class FirstPage {
|
|||||||
this.nav = nav;
|
this.nav = nav;
|
||||||
this.val = Math.round(Math.random() * 8999) + 1000;
|
this.val = Math.round(Math.random() * 8999) + 1000;
|
||||||
|
|
||||||
|
FirstPage.router.invoke(this);
|
||||||
|
|
||||||
this.pushPage = SecondPage;
|
this.pushPage = SecondPage;
|
||||||
this.pushData = {
|
this.pushData = {
|
||||||
id: 420
|
id: 420
|
||||||
@ -81,3 +83,7 @@ export class FirstPage {
|
|||||||
this.nav.push(SecondPage, { id: 8675309, myData: [1,2,3,4] }, { animation: 'ios' });
|
this.nav.push(SecondPage, { id: 8675309, myData: [1,2,3,4] }, { animation: 'ios' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new Routable(FirstPage, {
|
||||||
|
url: '/first-page'
|
||||||
|
})
|
||||||
|
@ -158,7 +158,13 @@ export class Routable {
|
|||||||
this.componentClass = componentClass;
|
this.componentClass = componentClass;
|
||||||
this.routeInfo = routeInfo;
|
this.routeInfo = routeInfo;
|
||||||
|
|
||||||
componentClass._route = this;
|
console.log('New routable', componentClass, routeInfo);
|
||||||
|
|
||||||
|
componentClass.router = this;
|
||||||
|
}
|
||||||
|
invoke(componentInstance) {
|
||||||
|
console.log('Routable invoke', componentInstance);
|
||||||
|
Router.emit(this.routeInfo.url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user