From 5a85d82b8a0a41b594edf62b32f43740358fd041 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 17 Jun 2016 12:15:01 -0500 Subject: [PATCH] fix(header): optional ViewController injection --- src/components/button/test/basic/main.html | 10 +++++--- src/components/toolbar/toolbar.ts | 28 ++++------------------ 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/components/button/test/basic/main.html b/src/components/button/test/basic/main.html index 0a1b3214e12..022cd4a8198 100644 --- a/src/components/button/test/basic/main.html +++ b/src/components/button/test/basic/main.html @@ -1,7 +1,11 @@ + + + + Default Buttons + + + - - Default Buttons - diff --git a/src/components/toolbar/toolbar.ts b/src/components/toolbar/toolbar.ts index c667e2865ae..91a7c726a2a 100644 --- a/src/components/toolbar/toolbar.ts +++ b/src/components/toolbar/toolbar.ts @@ -12,20 +12,11 @@ import {ViewController} from '../nav/view-controller'; selector: 'ion-header' }) export class Header { - private _h: number = 0; - constructor(viewCtr: ViewController, private _elementRef: ElementRef) { - viewCtr.setHeader(this); + constructor(@Optional() viewCtr: ViewController) { + viewCtr && viewCtr.setHeader(this); } - setHeight(heightPixels: number) { - this._h = heightPixels; - this._elementRef.nativeElement.style.height = (heightPixels > 0 ? heightPixels + 'px' : ''); - } - - getHeight(): number { - return this._h; - } } @@ -33,20 +24,11 @@ export class Header { selector: 'ion-footer' }) export class Footer { - private _h: number = 0; - constructor(viewCtr: ViewController, private _elementRef: ElementRef) { - viewCtr.setFooter(this); + constructor(@Optional() viewCtr: ViewController) { + viewCtr && viewCtr.setFooter(this); } - setHeight(heightPixels: number) { - this._h = heightPixels; - this._elementRef.nativeElement.style.height = (heightPixels > 0 ? heightPixels + 'px' : ''); - } - - getHeight(): number { - return this._h; - } } @@ -109,7 +91,7 @@ export class ToolbarBase extends Ion { * A Toolbar is a generic bar that is positioned above or below content. * Unlike a [Navbar](../../nav/Navbar), a toolbar can be used as a subheader. * When toolbars are placed within an `` or ``, - * they stay fixed in their respective location. When placed within + * the toolbars stay fixed in their respective location. When placed within * ``, toolbars will scroll with the content. * *