diff --git a/packages/core/src/components/nav/nav.tsx b/packages/core/src/components/nav/nav.tsx index bae73fff571..7ce217433c4 100644 --- a/packages/core/src/components/nav/nav.tsx +++ b/packages/core/src/components/nav/nav.tsx @@ -619,14 +619,9 @@ export class NavControllerBase implements NavOutlet { // render the component ref instance to the DOM // ******** DOM WRITE **************** this.el.appendChild(view.element); + view._state = STATE_ATTACHED; - // TODO: fails in test - if (view._cssClass) { - // the ElementRef of the actual ion-page created - // ******** DOM WRITE ****************+ - view.element.classList.add(view._cssClass); - } // successfully finished loading the entering view // fire off the "didLoad" lifecycle events view._didLoad(); diff --git a/packages/core/src/components/nav/view-controller.ts b/packages/core/src/components/nav/view-controller.ts index 1ac1fb02fe3..174ca9ea330 100644 --- a/packages/core/src/components/nav/view-controller.ts +++ b/packages/core/src/components/nav/view-controller.ts @@ -30,7 +30,6 @@ export class ViewController { _nav: NavControllerBase; _zIndex: number; _state: number = STATE_NEW; - _cssClass: string; /** @hidden */ id: string; @@ -44,15 +43,8 @@ export class ViewController { constructor( public component: any, - public data?: any, - rootCssClass: string = DEFAULT_CSS_CLASS - ) { - // component could be anything, never use it directly - // it could be a string, a HTMLElement - // passed in data could be NavParams, but all we care about is its data object - // this.data = (data instanceof NavParams ? data.data : (isPresent(data) ? data : {})); - this._cssClass = rootCssClass; - } + public data?: any + ) {} /** * @hidden @@ -65,6 +57,11 @@ export class ViewController { this.element = (typeof component === 'string') ? document.createElement(component) : component; + + this.element.classList.add('ion-page'); + if (this.data) { + Object.assign(this.element, this.data); + } } _setNav(navCtrl: NavControllerBase) { @@ -322,5 +319,3 @@ export class ViewController { export function isViewController(viewCtrl: any): viewCtrl is ViewController { return !!(viewCtrl && (viewCtrl)._didLoad && (viewCtrl)._willUnload); } - -const DEFAULT_CSS_CLASS = 'ion-page';