import {Parent, Ancestor} from 'angular2/src/core/annotations_impl/visibility';
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
import {View} from 'angular2/src/core/annotations_impl/view';
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {Injector} from 'angular2/di';
import {NavBase} from 'ionic/components/nav/nav-base';
import {NavItem, NavItemDynamicComponent} from 'ionic/components/nav/nav-item';
import {ToolbarContainer} from 'ionic/components/toolbar/toolbar';
@Component({
selector: 'ion-nav',
properties: {
initial: 'initial'
}
})
@View({
template: `
`,
directives: [HeaderAnchor, ContentAnchor]
})
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;
}
}
@Component({
selector: 'header-anchor'
})
class HeaderAnchor {
constructor(@Ancestor() nav: Nav, elementRef: ElementRef, viewContainerRef: ViewContainerRef) {
nav.headerAnchor = {
elementRef: elementRef,
viewContainerRef: viewContainerRef
};
}
}
@Component({
selector: 'content-anchor'
})
class ContentAnchor {
constructor(@Ancestor() nav: Nav, elementRef: ElementRef, viewContainerRef: ViewContainerRef) {
nav.contentAnchor = {
elementRef: elementRef,
viewContainerRef: viewContainerRef
};
}
}