From 17f64370fdc22d39318ade110f42d1079fdb2f2c Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 9 Oct 2015 00:16:25 -0500 Subject: [PATCH] fix(navController): fix this.add and _popTo ref --- ionic/components/nav/nav-controller.ts | 13 ++++++++++--- ionic/components/tabs/tabs.ts | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ionic/components/nav/nav-controller.ts b/ionic/components/nav/nav-controller.ts index 91edc2d10e..8e23c4c7b9 100644 --- a/ionic/components/nav/nav-controller.ts +++ b/ionic/components/nav/nav-controller.ts @@ -1,4 +1,4 @@ -import {ComponentRef, Compiler, ElementRef, Injector, bind, NgZone, DynamicComponentLoader, AppViewManager} from 'angular2/angular2'; +import {Compiler, ElementRef, Injector, bind, NgZone, DynamicComponentLoader, AppViewManager} from 'angular2/angular2'; import {Ion} from '../ion'; import {makeComponent} from '../../config/decorators'; @@ -305,7 +305,7 @@ export class NavController extends Ion { * @param opts extra animation options */ popToRoot(opts = {}) { - this.popTo(this._views[0]); + this._popTo(this.first()); } /** @@ -542,7 +542,14 @@ export class NavController extends Ion { viewContainer.remove(index); } }; - return new ComponentRef(newLocation, component, type, null, dispose); + + // TODO: make-shift ComponentRef_, this is pretty much going to + // break in future versions of ng2, keep an eye on it + return { + location: newLocation, + instance: component, + dispose: dispose + }; } /** diff --git a/ionic/components/tabs/tabs.ts b/ionic/components/tabs/tabs.ts index 1d51a8318d..11c079f094 100644 --- a/ionic/components/tabs/tabs.ts +++ b/ionic/components/tabs/tabs.ts @@ -146,7 +146,7 @@ export class Tabs extends NavController { * TODO */ addTab(tab) { - this.add(tab.viewCtrl); + this._add(tab.viewCtrl); // return true/false if it's the initial tab return (this.length() === 1);