Skip to content

Commit

Permalink
feat(nav): params
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Mar 8, 2018
1 parent 4a3030f commit 878d7e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
7 changes: 1 addition & 6 deletions packages/core/src/components/nav/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
19 changes: 7 additions & 12 deletions packages/core/src/components/nav/view-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export class ViewController {
_nav: NavControllerBase;
_zIndex: number;
_state: number = STATE_NEW;
_cssClass: string;

/** @hidden */
id: string;
Expand All @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -322,5 +319,3 @@ export class ViewController {
export function isViewController(viewCtrl: any): viewCtrl is ViewController {
return !!(viewCtrl && (<ViewController>viewCtrl)._didLoad && (<ViewController>viewCtrl)._willUnload);
}

const DEFAULT_CSS_CLASS = 'ion-page';

0 comments on commit 878d7e6

Please sign in to comment.