mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
fix toolbars
This commit is contained in:
@ -131,7 +131,7 @@ export class NavBase {
|
|||||||
|
|
||||||
_destroy(navItem) {
|
_destroy(navItem) {
|
||||||
console.warn(
|
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)
|
// util.array.remove(this._ngNavItems, navItem)
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,6 @@ export class NavController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addToolbar(placement: String, toolbar: Toolbar) {
|
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);
|
this.navItem._toolbars[placement].push(toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,7 @@ export class NavInjectable {}
|
|||||||
@NgView({
|
@NgView({
|
||||||
template: `
|
template: `
|
||||||
<header class="toolbar-container" [class.hide]="getToolbars('top').length == 0">
|
<header class="toolbar-container" [class.hide]="getToolbars('top').length == 0">
|
||||||
<div *for="#toolbar of getToolbars('top')" [toolbar-create]="toolbar">
|
<div *for="#toolbar of getToolbars('top')" [toolbar-create]="toolbar"></div>
|
||||||
</div>
|
|
||||||
</header>
|
</header>
|
||||||
<section class="nav-item-container">
|
<section class="nav-item-container">
|
||||||
<div class="nav-item"
|
<div class="nav-item"
|
||||||
@ -44,8 +43,7 @@ export class NavInjectable {}
|
|||||||
[item]="item"></div>
|
[item]="item"></div>
|
||||||
</section>
|
</section>
|
||||||
<footer class="toolbar-container" [class.hide]="getToolbars('bottom').length == 0">
|
<footer class="toolbar-container" [class.hide]="getToolbars('bottom').length == 0">
|
||||||
<div *for="#toolbar of getToolbars('bottom')" [toolbar-create]="toolbar">
|
<div *for="#toolbar of getToolbars('bottom')" [toolbar-create]="toolbar"></div>
|
||||||
</div>
|
|
||||||
</footer>
|
</footer>
|
||||||
`,
|
`,
|
||||||
directives: [NavItem, For, If, ToolbarContainer]
|
directives: [NavItem, For, If, ToolbarContainer]
|
||||||
|
@ -144,17 +144,17 @@ export class ToolbarTitle {
|
|||||||
})
|
})
|
||||||
export class ToolbarContainer {
|
export class ToolbarContainer {
|
||||||
constructor(
|
constructor(
|
||||||
//viewContainer: ViewContainerRef,
|
viewContainer: ViewContainer,
|
||||||
element: NgElement
|
element: NgElement
|
||||||
) {
|
) {
|
||||||
//this.viewContainer = viewContainer;
|
this.viewContainer = viewContainer;
|
||||||
this.domElement = element.domElement;
|
this.domElement = element.domElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
set toolbar(bar: Toolbar) {
|
set toolbar(bar: Toolbar) {
|
||||||
if (bar) {
|
if (bar) {
|
||||||
// TODO create with correct context
|
// 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())
|
console.log('creating viewportContainer', performance.now())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user