mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
rename Router to Router_OLD
This commit is contained in:
@ -5,9 +5,7 @@ import {View} from 'angular2/src/core/annotations_impl/view';
|
|||||||
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
||||||
import {Log} from 'ionic/util'
|
import {Log} from 'ionic/util'
|
||||||
|
|
||||||
import {
|
import {Routable, IonicView, NavController} from 'ionic/ionic'
|
||||||
Router, Routable, IonicView, NavController
|
|
||||||
} from 'ionic/ionic'
|
|
||||||
|
|
||||||
|
|
||||||
@Component({selector: 'ion-view'})
|
@Component({selector: 'ion-view'})
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
import {ElementRef, For, Parent} from 'angular2/angular2'
|
import {ElementRef} from 'angular2/angular2';
|
||||||
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 {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
||||||
import {Log} from 'ionic/util'
|
|
||||||
|
|
||||||
import {
|
import {Routable, NavController, IonicView} from 'ionic/ionic';
|
||||||
Router, Routable, NavController,
|
|
||||||
IonicView
|
|
||||||
} from 'ionic/ionic'
|
|
||||||
|
|
||||||
|
|
||||||
@Component({selector: 'ion-view'})
|
@Component({selector: 'ion-view'})
|
||||||
@ -37,27 +31,6 @@ class IonicApp {
|
|||||||
this.rootView = AppPage
|
this.rootView = AppPage
|
||||||
|
|
||||||
this.menuOpenAmount = 0;
|
this.menuOpenAmount = 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
setTimeout(() => {
|
|
||||||
var nav = window.nav;
|
|
||||||
|
|
||||||
var route = Router;//new Router()
|
|
||||||
route.on('/login', (data) => {
|
|
||||||
nav.push(LoginPage);
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
route.on('/post/:id', (data) => {
|
|
||||||
console.log('ROUTE: Post page', data)
|
|
||||||
nav.push(PostDetail, data);
|
|
||||||
})
|
|
||||||
|
|
||||||
route.otherwise('/login');
|
|
||||||
|
|
||||||
}, 200);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMenuOpening(amt) {
|
onMenuOpening(amt) {
|
||||||
|
@ -17,6 +17,25 @@ class MyApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function main(ionicBootstrap) {
|
export function main(ionicBootstrap) {
|
||||||
|
|
||||||
|
var routes = {
|
||||||
|
FirstPage: {
|
||||||
|
url: 'firstpage',
|
||||||
|
module: './first-page',
|
||||||
|
},
|
||||||
|
SecondPage: {
|
||||||
|
url: 'secondpage',
|
||||||
|
module: './second-page'
|
||||||
|
},
|
||||||
|
ThirdPage: {
|
||||||
|
url: 'thirdpage',
|
||||||
|
module: './third-page'
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
let myConfig = new IonicConfig();
|
let myConfig = new IonicConfig();
|
||||||
ionicBootstrap(MyApp, myConfig);
|
|
||||||
|
//myConfig.routes(routes);
|
||||||
|
|
||||||
|
ionicBootstrap(MyApp, myConfig, routes);
|
||||||
}
|
}
|
||||||
|
@ -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 {IonicView, IonicConfig, IonicApp} from 'ionic/ionic';
|
import {IonicView, IonicConfig, IonicApp} from 'ionic/ionic';
|
||||||
import {NavParams, Routable, Router, NavController} from 'ionic/ionic';
|
import {NavParams, Routable, Router_OLD, NavController} from 'ionic/ionic';
|
||||||
|
|
||||||
import {SecondPage} from './second-page'
|
import {SecondPage} from './second-page'
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ export class FirstPage {
|
|||||||
console.log('config', config)
|
console.log('config', config)
|
||||||
|
|
||||||
// TODO: Shouldn't have to do this
|
// TODO: Shouldn't have to do this
|
||||||
Router.setNavController(nav);
|
Router_OLD.setNavController(nav);
|
||||||
|
|
||||||
this.nav = nav;
|
this.nav = nav;
|
||||||
this.val = Math.round(Math.random() * 8999) + 1000;
|
this.val = Math.round(Math.random() * 8999) + 1000;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Component} from 'angular2/src/core/annotations_impl/annotations';
|
import {Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
|
|
||||||
import {IonicView, Routable, Router, NavController, NavParams} from 'ionic/ionic';
|
import {IonicView, Routable, Router_OLD, NavController, NavParams} from 'ionic/ionic';
|
||||||
import {ThirdPage} from './third-page';
|
import {ThirdPage} from './third-page';
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ export class SecondPage {
|
|||||||
params: NavParams
|
params: NavParams
|
||||||
) {
|
) {
|
||||||
// TODO: Shouldn't have to do this
|
// TODO: Shouldn't have to do this
|
||||||
Router.setNavController(nav);
|
Router_OLD.setNavController(nav);
|
||||||
|
|
||||||
this.nav = nav;
|
this.nav = nav;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Component} from 'angular2/src/core/annotations_impl/annotations';
|
import {Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
|
|
||||||
import {IonicView, Router, Routable, NavController} from 'ionic/ionic';
|
import {IonicView, Router_OLD, Routable, NavController} from 'ionic/ionic';
|
||||||
|
|
||||||
|
|
||||||
@Component({selector: 'ion-view'})
|
@Component({selector: 'ion-view'})
|
||||||
@ -22,7 +22,7 @@ export class ThirdPage {
|
|||||||
this.nav = nav
|
this.nav = nav
|
||||||
|
|
||||||
// TODO: Shouldn't have to do this
|
// TODO: Shouldn't have to do this
|
||||||
Router.setNavController(nav);
|
Router_OLD.setNavController(nav);
|
||||||
}
|
}
|
||||||
|
|
||||||
pop() {
|
pop() {
|
||||||
|
@ -209,9 +209,9 @@ export class Routable {
|
|||||||
this.routeInfo = routeInfo;
|
this.routeInfo = routeInfo;
|
||||||
|
|
||||||
//console.log('New routable', componentClass, routeInfo);
|
//console.log('New routable', componentClass, routeInfo);
|
||||||
Router.on(this.routeInfo.url, (routeParams) => {
|
Router_OLD.on(this.routeInfo.url, (routeParams) => {
|
||||||
console.log('Routable matched', routeParams, this.componentClass);
|
console.log('Routable matched', routeParams, this.componentClass);
|
||||||
Router.push(this.componentClass, routeParams);
|
Router_OLD.push(this.componentClass, routeParams);
|
||||||
});
|
});
|
||||||
|
|
||||||
componentClass.router = this;
|
componentClass.router = this;
|
||||||
@ -223,7 +223,7 @@ export class Routable {
|
|||||||
// Bind some lifecycle events
|
// Bind some lifecycle events
|
||||||
componentInstance._viewWillEnter.observer({
|
componentInstance._viewWillEnter.observer({
|
||||||
next: () => {
|
next: () => {
|
||||||
Router.emit(this.routeInfo.url);
|
Router_OLD.emit(this.routeInfo.url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -232,6 +232,6 @@ export class Routable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var Router = new RouterController();
|
var Router_OLD = new RouterController();
|
||||||
|
|
||||||
export { Router, Route, Routable };
|
export { Router_OLD, Route, Routable };
|
||||||
|
Reference in New Issue
Block a user