fix toolbars

This commit is contained in:
Adam Bradley
2015-05-03 19:22:23 -05:00
parent aba2906b29
commit 0c497484b6
4 changed files with 6 additions and 13 deletions

View File

@ -131,7 +131,7 @@ export class NavBase {
_destroy(navItem) {
console.warn(
`Component "${navItem.Class.name}" was popped from the nav stack, but wer'e keeping its element in the DOM for now because of an ng2 bug.`
`Component "${navItem.Class.name}" was popped from the nav stack, but we are keeping its element in the DOM for now because of an ng2 bug.`
);
// util.array.remove(this._ngNavItems, navItem)
}

View File

@ -33,11 +33,6 @@ export class NavController {
}
addToolbar(placement: String, toolbar: Toolbar) {
if (!this.navItem._toolbars[placement]) {
return console.error(
`Toolbar must have a placement of top or bottom, found toolbar ${toolbar} with placement ${placement}!`
);
}
this.navItem._toolbars[placement].push(toolbar);
}

View File

@ -35,8 +35,7 @@ export class NavInjectable {}
@NgView({
template: `
<header class="toolbar-container" [class.hide]="getToolbars('top').length == 0">
<div *for="#toolbar of getToolbars('top')" [toolbar-create]="toolbar">
</div>
<div *for="#toolbar of getToolbars('top')" [toolbar-create]="toolbar"></div>
</header>
<section class="nav-item-container">
<div class="nav-item"
@ -44,8 +43,7 @@ export class NavInjectable {}
[item]="item"></div>
</section>
<footer class="toolbar-container" [class.hide]="getToolbars('bottom').length == 0">
<div *for="#toolbar of getToolbars('bottom')" [toolbar-create]="toolbar">
</div>
<div *for="#toolbar of getToolbars('bottom')" [toolbar-create]="toolbar"></div>
</footer>
`,
directives: [NavItem, For, If, ToolbarContainer]

View File

@ -144,17 +144,17 @@ export class ToolbarTitle {
})
export class ToolbarContainer {
constructor(
//viewContainer: ViewContainerRef,
viewContainer: ViewContainer,
element: NgElement
) {
//this.viewContainer = viewContainer;
this.viewContainer = viewContainer;
this.domElement = element.domElement;
}
set toolbar(bar: Toolbar) {
if (bar) {
// TODO create with correct context
//this.viewContainer.create(-1, bar.viewContainer._defaultProtoView, bar.elementRef.elementInjector);
this.viewContainer.create(-1, bar.viewContainer.defaultProtoView, bar.elementRef.elementInjector);
console.log('creating viewportContainer', performance.now())
}
}