diff --git a/src/navigation/nav-controller.ts b/src/navigation/nav-controller.ts index d4e4760b94..b7f60979c2 100644 --- a/src/navigation/nav-controller.ts +++ b/src/navigation/nav-controller.ts @@ -472,6 +472,14 @@ export abstract class NavController { */ abstract popTo(page: any, params?: any, opts?: NavOptions, done?: Function): Promise; + /** + * @private + * Pop sequently all the pages in the stack. + * + * @returns {Promise} Returns a promise which is resolved when the transition has completed. + */ + abstract popAll(): Promise; + /** * Removes a page from the nav stack at the specified index. * diff --git a/src/navigation/view-controller.ts b/src/navigation/view-controller.ts index fc07676687..58d0b7ca0f 100644 --- a/src/navigation/view-controller.ts +++ b/src/navigation/view-controller.ts @@ -3,7 +3,7 @@ import { ComponentRef, ElementRef, EventEmitter, Output, Renderer } from '@angul import { Footer, Header } from '../components/toolbar/toolbar'; import { isPresent, assign } from '../util/util'; import { Navbar } from '../components/navbar/navbar'; -import { NavControllerBase } from './nav-controller-base'; +import { NavController } from './nav-controller'; import { NavOptions, ViewState } from './nav-util'; import { NavParams } from './nav-params'; import { Content } from '../components/content/content'; @@ -27,6 +27,7 @@ import { Content } from '../components/content/content'; * ``` */ export class ViewController { + private _cntDir: any; private _cntRef: ElementRef; private _ionCntDir: Content; @@ -42,6 +43,12 @@ export class ViewController { private _dismissRole: any; private _detached: boolean; + _cmp: ComponentRef; + _nav: NavController; + _zIndex: number; + _state: ViewState; + _cssClass: string; + /** * Observable to be subscribed to when the current component will become active * @returns {Observable} Returns an observable @@ -84,21 +91,6 @@ export class ViewController { /** @private */ isOverlay: boolean = false; - /** @private */ - _cmp: ComponentRef; - - /** @private */ - _nav: NavControllerBase; - - /** @private */ - _zIndex: number; - - /** @private */ - _state: ViewState; - - /** @private */ - _cssClass: string; - /** @private */ @Output() private _emitter: EventEmitter = new EventEmitter(); @@ -118,16 +110,10 @@ export class ViewController { this._detached = false; } - /** - * @private - */ - _setNav(navCtrl: NavControllerBase) { + _setNav(navCtrl: NavController) { this._nav = navCtrl; } - /** - * @private - */ _setInstance(instance: any) { this.instance = instance; } @@ -181,7 +167,7 @@ export class ViewController { /** * @private */ - getNav() { + getNav(): NavController { return this._nav; } @@ -299,9 +285,6 @@ export class ViewController { return this._cmp && this._cmp.location; } - /** - * @private - */ _setContent(directive: any) { this._cntDir = directive; } @@ -313,9 +296,6 @@ export class ViewController { return this._cntDir; } - /** - * @private - */ _setContentRef(elementRef: ElementRef) { this._cntRef = elementRef; } @@ -327,9 +307,6 @@ export class ViewController { return this._cntRef; } - /** - * @private - */ _setIONContent(content: Content) { this._setContent(content); this._ionCntDir = content; @@ -342,9 +319,6 @@ export class ViewController { return this._ionCntDir; } - /** - * @private - */ _setIONContentRef(elementRef: ElementRef) { this._setContentRef(elementRef); this._ionCntRef = elementRef; @@ -357,9 +331,6 @@ export class ViewController { return this._ionCntRef; } - /** - * @private - */ _setHeader(directive: Header) { this._hdrDir = directive; } @@ -367,13 +338,10 @@ export class ViewController { /** * @private */ - getHeader() { + getHeader(): Header { return this._hdrDir; } - /** - * @private - */ _setFooter(directive: Footer) { this._ftrDir = directive; } @@ -381,13 +349,10 @@ export class ViewController { /** * @private */ - getFooter() { + getFooter(): Footer { return this._ftrDir; } - /** - * @private - */ _setNavbar(directive: Navbar) { this._nb = directive; } @@ -429,9 +394,6 @@ export class ViewController { } } - /** - * @private - */ _preLoad() { this._lifecycle('PreLoad'); } @@ -536,7 +498,7 @@ export class ViewController { if (renderer) { // ensure the element is cleaned up for when the view pool reuses this element // ******** DOM WRITE **************** - const cmpEle = this._cmp.location.nativeElement; + var cmpEle = this._cmp.location.nativeElement; renderer.setElementAttribute(cmpEle, 'class', null); renderer.setElementAttribute(cmpEle, 'style', null); } @@ -552,8 +514,8 @@ export class ViewController { * @private */ _lifecycleTest(lifecycle: string): boolean | Promise { - let instance = this.instance; - let methodName = 'ionViewCan' + lifecycle; + const instance = this.instance; + const methodName = 'ionViewCan' + lifecycle; if (instance && instance[methodName]) { try { let result = instance[methodName](); @@ -574,8 +536,8 @@ export class ViewController { } _lifecycle(lifecycle: string) { - let instance = this.instance; - let methodName = 'ionView' + lifecycle; + const instance = this.instance; + const methodName = 'ionView' + lifecycle; if (instance && instance[methodName]) { try { instance[methodName](); @@ -588,7 +550,7 @@ export class ViewController { } -export function isViewController(viewCtrl: any) { +export function isViewController(viewCtrl: any): boolean { return !!(viewCtrl && (viewCtrl)._didLoad && (viewCtrl)._willUnload); }