From 8c48693bf745e0d2293b4891fd83fb42611081d3 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Mon, 29 Jun 2015 11:17:52 -0500 Subject: [PATCH] rename Router to Router_OLD --- ionic/components/app/test/barkpark/index.js | 4 +-- ionic/components/app/test/music/index.js | 31 ++----------------- ionic/components/nav/test/basic/index.js | 21 ++++++++++++- .../nav/test/basic/pages/first-page.js | 4 +-- .../nav/test/basic/pages/second-page.js | 4 +-- .../nav/test/basic/pages/third-page.js | 4 +-- ionic/routing/router.js | 10 +++--- 7 files changed, 34 insertions(+), 44 deletions(-) diff --git a/ionic/components/app/test/barkpark/index.js b/ionic/components/app/test/barkpark/index.js index 98265c36df..6058af9172 100644 --- a/ionic/components/app/test/barkpark/index.js +++ b/ionic/components/app/test/barkpark/index.js @@ -5,9 +5,7 @@ import {View} from 'angular2/src/core/annotations_impl/view'; import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms'; import {Log} from 'ionic/util' -import { - Router, Routable, IonicView, NavController -} from 'ionic/ionic' +import {Routable, IonicView, NavController} from 'ionic/ionic' @Component({selector: 'ion-view'}) diff --git a/ionic/components/app/test/music/index.js b/ionic/components/app/test/music/index.js index df2a489ebd..6a2bf1fec5 100644 --- a/ionic/components/app/test/music/index.js +++ b/ionic/components/app/test/music/index.js @@ -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 {View} from 'angular2/src/core/annotations_impl/view'; - import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms'; -import {Log} from 'ionic/util' -import { - Router, Routable, NavController, - IonicView -} from 'ionic/ionic' +import {Routable, NavController, IonicView} from 'ionic/ionic'; @Component({selector: 'ion-view'}) @@ -37,27 +31,6 @@ class IonicApp { this.rootView = AppPage 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) { diff --git a/ionic/components/nav/test/basic/index.js b/ionic/components/nav/test/basic/index.js index e9a5438211..6622c8dfc7 100644 --- a/ionic/components/nav/test/basic/index.js +++ b/ionic/components/nav/test/basic/index.js @@ -17,6 +17,25 @@ class MyApp { } 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(); - ionicBootstrap(MyApp, myConfig); + + //myConfig.routes(routes); + + ionicBootstrap(MyApp, myConfig, routes); } diff --git a/ionic/components/nav/test/basic/pages/first-page.js b/ionic/components/nav/test/basic/pages/first-page.js index bc5dd8d572..b266559aed 100644 --- a/ionic/components/nav/test/basic/pages/first-page.js +++ b/ionic/components/nav/test/basic/pages/first-page.js @@ -1,7 +1,7 @@ import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; 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' @@ -40,7 +40,7 @@ export class FirstPage { console.log('config', config) // TODO: Shouldn't have to do this - Router.setNavController(nav); + Router_OLD.setNavController(nav); this.nav = nav; this.val = Math.round(Math.random() * 8999) + 1000; diff --git a/ionic/components/nav/test/basic/pages/second-page.js b/ionic/components/nav/test/basic/pages/second-page.js index 4479186e01..144a0f12a6 100644 --- a/ionic/components/nav/test/basic/pages/second-page.js +++ b/ionic/components/nav/test/basic/pages/second-page.js @@ -1,6 +1,6 @@ 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'; @@ -31,7 +31,7 @@ export class SecondPage { params: NavParams ) { // TODO: Shouldn't have to do this - Router.setNavController(nav); + Router_OLD.setNavController(nav); this.nav = nav; this.params = params; diff --git a/ionic/components/nav/test/basic/pages/third-page.js b/ionic/components/nav/test/basic/pages/third-page.js index a035c1dd4e..d4cfdb4cfb 100644 --- a/ionic/components/nav/test/basic/pages/third-page.js +++ b/ionic/components/nav/test/basic/pages/third-page.js @@ -1,6 +1,6 @@ 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'}) @@ -22,7 +22,7 @@ export class ThirdPage { this.nav = nav // TODO: Shouldn't have to do this - Router.setNavController(nav); + Router_OLD.setNavController(nav); } pop() { diff --git a/ionic/routing/router.js b/ionic/routing/router.js index 2ab7c3cd6b..f81f078283 100644 --- a/ionic/routing/router.js +++ b/ionic/routing/router.js @@ -209,9 +209,9 @@ export class Routable { this.routeInfo = 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); - Router.push(this.componentClass, routeParams); + Router_OLD.push(this.componentClass, routeParams); }); componentClass.router = this; @@ -223,7 +223,7 @@ export class Routable { // Bind some lifecycle events componentInstance._viewWillEnter.observer({ 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 };