fix(navController): fix this.add and _popTo ref

This commit is contained in:
Adam Bradley
2015-10-09 00:16:25 -05:00
parent 72ad5c1fb5
commit 17f64370fd
2 changed files with 11 additions and 4 deletions

View File

@ -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 {Ion} from '../ion';
import {makeComponent} from '../../config/decorators'; import {makeComponent} from '../../config/decorators';
@ -305,7 +305,7 @@ export class NavController extends Ion {
* @param opts extra animation options * @param opts extra animation options
*/ */
popToRoot(opts = {}) { popToRoot(opts = {}) {
this.popTo(this._views[0]); this._popTo(this.first());
} }
/** /**
@ -542,7 +542,14 @@ export class NavController extends Ion {
viewContainer.remove(index); 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
};
} }
/** /**

View File

@ -146,7 +146,7 @@ export class Tabs extends NavController {
* TODO * TODO
*/ */
addTab(tab) { addTab(tab) {
this.add(tab.viewCtrl); this._add(tab.viewCtrl);
// return true/false if it's the initial tab // return true/false if it's the initial tab
return (this.length() === 1); return (this.length() === 1);