mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
nest components in ion-nav
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import {Directive, onInit} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {Component, Directive, onInit} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
import {Parent} from 'angular2/src/core/annotations_impl/visibility';
|
||||
import {Optional} from 'angular2/src/di/annotations_impl';
|
||||
import {Compiler} from 'angular2/angular2';
|
||||
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
||||
@@ -8,13 +10,17 @@ import {Injector} from 'angular2/di';
|
||||
import {ViewController} from '../view/view-controller';
|
||||
|
||||
|
||||
@Directive({
|
||||
@Component({
|
||||
selector: 'ion-nav',
|
||||
properties: [
|
||||
'initial'
|
||||
],
|
||||
lifecycle: [onInit]
|
||||
})
|
||||
@View({
|
||||
template: '<template pane-anchor></template>',
|
||||
directives: [PaneAnchor]
|
||||
})
|
||||
export class Nav extends ViewController {
|
||||
|
||||
constructor(
|
||||
@@ -25,7 +31,6 @@ export class Nav extends ViewController {
|
||||
injector: Injector
|
||||
) {
|
||||
super(viewCtrl, compiler, elementRef, loader, injector);
|
||||
this.anchorElementRef(elementRef);
|
||||
}
|
||||
|
||||
onInit() {
|
||||
@@ -33,3 +38,12 @@ export class Nav extends ViewController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Directive({
|
||||
selector: 'template[pane-anchor]'
|
||||
})
|
||||
class PaneAnchor {
|
||||
constructor(@Parent() nav: Nav, elementRef: ElementRef) {
|
||||
nav.anchorElementRef(elementRef);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user