mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
feat(nav): params
This commit is contained in:
@ -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();
|
||||
|
@ -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 && (<ViewController>viewCtrl)._didLoad && (<ViewController>viewCtrl)._willUnload);
|
||||
}
|
||||
|
||||
const DEFAULT_CSS_CLASS = 'ion-page';
|
||||
|
Reference in New Issue
Block a user