mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
nav things
This commit is contained in:
@@ -15,7 +15,9 @@ const CACHED_STATE = 'cached';
|
||||
|
||||
export class NavBase {
|
||||
|
||||
constructor() {
|
||||
constructor(loader, injector) {
|
||||
this.loader = loader;
|
||||
this.injector = injector;
|
||||
this.items = [];
|
||||
this.navCtrl = new NavController(this);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export class NavItem {
|
||||
bind(NavItem).toValue(this)
|
||||
]);
|
||||
|
||||
this.nav.loader.loadNextToExistingLocation(this.Class, this.nav.contentAnchor.elementRef, injector).then((componentRef) => {
|
||||
this.nav.loader.loadNextToExistingLocation(this.Class, this.nav.contentElementRef, injector).then((componentRef) => {
|
||||
|
||||
// content
|
||||
this.component = componentRef;
|
||||
@@ -42,8 +42,10 @@ export class NavItem {
|
||||
this.domElement.classList.add('nav-item');
|
||||
this.domElement.setAttribute('data-nav-item-id', this.id);
|
||||
|
||||
let context = this.nav.contentElementRef
|
||||
|
||||
for (let i = 0; i < this.headers.length; i++) {
|
||||
this.createHeader(this.headers[i], injector);
|
||||
this.createHeader(this.headers[i], context, injector);
|
||||
}
|
||||
|
||||
resolve();
|
||||
@@ -52,11 +54,10 @@ export class NavItem {
|
||||
return promise;
|
||||
}
|
||||
|
||||
createHeader(toolbarProtoView, injector) {
|
||||
let vc = this.nav.headerAnchor.viewContainerRef;
|
||||
createHeader(toolbarProtoView, context, injector) {
|
||||
let vc = this.nav.headerContainerRef;
|
||||
|
||||
let atIndex = -1;
|
||||
let context = this.nav.headerAnchor.elementRef;
|
||||
|
||||
let view = vc.create(toolbarProtoView, atIndex, context, injector);
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ import {ToolbarContainer} from 'ionic/components/toolbar/toolbar';
|
||||
<section class="nav-item-container">
|
||||
<content-anchor></content-anchor>
|
||||
</section>
|
||||
<footer>
|
||||
</footer>
|
||||
`,
|
||||
directives: [HeaderAnchor, ContentAnchor]
|
||||
})
|
||||
@@ -34,14 +32,9 @@ export class Nav extends NavBase {
|
||||
|
||||
constructor(
|
||||
loader: DynamicComponentLoader,
|
||||
elementRef: ElementRef,
|
||||
injector: Injector
|
||||
) {
|
||||
super();
|
||||
this.loader = loader;
|
||||
this.viewManager = loader._viewManager;
|
||||
this.elementRef = elementRef;
|
||||
this.injector = injector;
|
||||
super(loader, injector);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,11 +44,8 @@ export class Nav extends NavBase {
|
||||
selector: 'header-anchor'
|
||||
})
|
||||
class HeaderAnchor {
|
||||
constructor(@Ancestor() nav: Nav, elementRef: ElementRef, viewContainerRef: ViewContainerRef) {
|
||||
nav.headerAnchor = {
|
||||
elementRef: elementRef,
|
||||
viewContainerRef: viewContainerRef
|
||||
};
|
||||
constructor(@Ancestor() nav: Nav, viewContainerRef: ViewContainerRef) {
|
||||
nav.headerContainerRef = viewContainerRef;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,10 +54,7 @@ class HeaderAnchor {
|
||||
selector: 'content-anchor'
|
||||
})
|
||||
class ContentAnchor {
|
||||
constructor(@Ancestor() nav: Nav, elementRef: ElementRef, viewContainerRef: ViewContainerRef) {
|
||||
nav.contentAnchor = {
|
||||
elementRef: elementRef,
|
||||
viewContainerRef: viewContainerRef
|
||||
};
|
||||
constructor(@Ancestor() nav: Nav, elementRef: ElementRef) {
|
||||
nav.contentElementRef = elementRef;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user