Skip to content

Commit 878d7e6

Browse files
committed
feat(nav): params
1 parent 4a3030f commit 878d7e6

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

packages/core/src/components/nav/nav.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -619,14 +619,9 @@ export class NavControllerBase implements NavOutlet {
619619
// render the component ref instance to the DOM
620620
// ******** DOM WRITE ****************
621621
this.el.appendChild(view.element);
622+
622623
view._state = STATE_ATTACHED;
623624

624-
// TODO: fails in test
625-
if (view._cssClass) {
626-
// the ElementRef of the actual ion-page created
627-
// ******** DOM WRITE ****************+
628-
view.element.classList.add(view._cssClass);
629-
}
630625
// successfully finished loading the entering view
631626
// fire off the "didLoad" lifecycle events
632627
view._didLoad();

packages/core/src/components/nav/view-controller.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export class ViewController {
3030
_nav: NavControllerBase;
3131
_zIndex: number;
3232
_state: number = STATE_NEW;
33-
_cssClass: string;
3433

3534
/** @hidden */
3635
id: string;
@@ -44,15 +43,8 @@ export class ViewController {
4443

4544
constructor(
4645
public component: any,
47-
public data?: any,
48-
rootCssClass: string = DEFAULT_CSS_CLASS
49-
) {
50-
// component could be anything, never use it directly
51-
// it could be a string, a HTMLElement
52-
// passed in data could be NavParams, but all we care about is its data object
53-
// this.data = (data instanceof NavParams ? data.data : (isPresent(data) ? data : {}));
54-
this._cssClass = rootCssClass;
55-
}
46+
public data?: any
47+
) {}
5648

5749
/**
5850
* @hidden
@@ -65,6 +57,11 @@ export class ViewController {
6557
this.element = (typeof component === 'string')
6658
? document.createElement(component)
6759
: component;
60+
61+
this.element.classList.add('ion-page');
62+
if (this.data) {
63+
Object.assign(this.element, this.data);
64+
}
6865
}
6966

7067
_setNav(navCtrl: NavControllerBase) {
@@ -322,5 +319,3 @@ export class ViewController {
322319
export function isViewController(viewCtrl: any): viewCtrl is ViewController {
323320
return !!(viewCtrl && (<ViewController>viewCtrl)._didLoad && (<ViewController>viewCtrl)._willUnload);
324321
}
325-
326-
const DEFAULT_CSS_CLASS = 'ion-page';

0 commit comments

Comments
 (0)