tab cleanup

This commit is contained in:
Adam Bradley
2015-06-09 09:10:01 -05:00
parent 611b7582b0
commit 7ea9929ab1
2 changed files with 4 additions and 13 deletions

View File

@ -51,26 +51,16 @@ export class Tab extends NavBase {
) { ) {
super(tabs, compiler, elementRef, loader, injector); super(tabs, compiler, elementRef, loader, injector);
if (tabs.parent) { this.tabs = tabs;
this.sections = tabs.parent.panes['_n'].sections;
}
this.item = new NavItem(tabs.parent); this.item = new NavItem(tabs.parent);
this.item.setInstance(this); this.item.setInstance(this);
this.item.setViewElement(elementRef.domElement); this.item.setViewElement(elementRef.domElement);
this.panes['_n'] = this;
tabs.addTab(this.item); tabs.addTab(this.item);
this.tabs = tabs;
this.panelId = 'tab-panel-' + this.item.id; this.panelId = 'tab-panel-' + this.item.id;
this.labeledBy = 'tab-button-' + this.item.id; this.labeledBy = 'tab-button-' + this.item.id;
this.elementRef = elementRef;
this.viewContainerRef = viewContainerRef;
this.panes['_n'] = this;
this.domElement = elementRef.domElement;
} }
onInit() { onInit() {
@ -107,6 +97,6 @@ export class Tab extends NavBase {
}) })
class TabContentAnchor { class TabContentAnchor {
constructor(@Parent() tab: Tab, viewContainerRef: ViewContainerRef) { constructor(@Parent() tab: Tab, viewContainerRef: ViewContainerRef) {
tab.contentContainerRef = viewContainerRef; this.contentContainerRef = viewContainerRef;
} }
} }

View File

@ -87,6 +87,7 @@ export class Tabs extends NavBase {
leavingItem.shouldCache = true; leavingItem.shouldCache = true;
leavingItem.willCache(); leavingItem.willCache();
// set the Tab navbarView from the active view in the tab
enteringItem.navbarView = (enteringItem.instance.getActive() || {}).navbarView; enteringItem.navbarView = (enteringItem.instance.getActive() || {}).navbarView;
if (leavingItem.instance) { if (leavingItem.instance) {
leavingItem.navbarView = (leavingItem.instance.getActive() || {}).navbarView; leavingItem.navbarView = (leavingItem.instance.getActive() || {}).navbarView;