mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
ion-nav is the anchor
This commit is contained in:
@@ -8,22 +8,15 @@ import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_compone
|
||||
import {Injector} from 'angular2/di';
|
||||
|
||||
import {ViewController} from '../view/view-controller';
|
||||
import {IonicComponent} from '../../config/component';
|
||||
|
||||
|
||||
@Component({
|
||||
@Directive({
|
||||
selector: 'ion-nav',
|
||||
properties: [
|
||||
'initial'
|
||||
],
|
||||
lifecycle: [onInit]
|
||||
})
|
||||
@View({
|
||||
template: `
|
||||
<template pane-anchor></template>
|
||||
`,
|
||||
directives: [NavPaneAnchor]
|
||||
})
|
||||
export class Nav extends ViewController {
|
||||
|
||||
constructor(
|
||||
@@ -34,9 +27,7 @@ export class Nav extends ViewController {
|
||||
injector: Injector
|
||||
) {
|
||||
super(viewController, compiler, elementRef, loader, injector);
|
||||
|
||||
this.domElement = elementRef.domElement;
|
||||
this.config = Nav.config.invoke(this);
|
||||
this.panes.setAnchor(elementRef);
|
||||
}
|
||||
|
||||
onInit() {
|
||||
@@ -44,14 +35,3 @@ export class Nav extends ViewController {
|
||||
}
|
||||
|
||||
}
|
||||
new IonicComponent(Nav, {});
|
||||
|
||||
|
||||
@Directive({
|
||||
selector: 'template[pane-anchor]'
|
||||
})
|
||||
class NavPaneAnchor {
|
||||
constructor(@Parent() nav: Nav, elementRef: ElementRef) {
|
||||
nav.panes.setAnchor(elementRef);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,9 +92,12 @@ export class PaneController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Component({selector:'ion-pane'})
|
||||
@Component({
|
||||
selector:'ion-pane',
|
||||
hostAttributes: {
|
||||
'class': 'nav nav-ios'
|
||||
}
|
||||
})
|
||||
@View({
|
||||
template: `
|
||||
<template pane-anchor></template>
|
||||
@@ -110,6 +113,7 @@ class Pane {
|
||||
this.sections = {};
|
||||
nav.panes.add(this);
|
||||
}
|
||||
|
||||
addSection(sectionName, instance) {
|
||||
this.sections[sectionName] = instance;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export class ViewItem {
|
||||
constructor(viewController, ComponentClass, params = {}) {
|
||||
this.viewController = viewController;
|
||||
this.ComponentClass = ComponentClass;
|
||||
this.params = new NavParams(this.params);
|
||||
this.params = new NavParams(params);
|
||||
this.instance = null;
|
||||
this.state = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user