diff --git a/src/components/popover/popover-component.ts b/src/components/popover/popover-component.ts index 8511564b2ab..6a7b4e53eae 100644 --- a/src/components/popover/popover-component.ts +++ b/src/components/popover/popover-component.ts @@ -34,7 +34,11 @@ import { ViewController } from '../nav/view-controller'; export class PopoverCmp { @ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef; - private d: any; + private d: { + cssClass?: string; + showBackdrop?: boolean; + enableBackdropDismiss?: boolean; + }; private enabled: boolean; private id: number; private showSpinner: boolean; @@ -50,7 +54,10 @@ export class PopoverCmp { this.d = _navParams.data.opts; if (this.d.cssClass) { - _renderer.setElementClass(_elementRef.nativeElement, this.d.cssClass, true); + this.d.cssClass.split(' ').forEach(cssClass => { + // Make sure the class isn't whitespace, otherwise it throws exceptions + if (cssClass.trim() !== '') _renderer.setElementClass(_elementRef.nativeElement, cssClass, true); + }); } this.id = (++popoverIds); diff --git a/src/components/popover/test/basic/index.ts b/src/components/popover/test/basic/index.ts index cd70dc4b291..ad99dcc6132 100644 --- a/src/components/popover/test/basic/index.ts +++ b/src/components/popover/test/basic/index.ts @@ -189,7 +189,9 @@ class E2EPage { } presentLongListPopover(ev: UIEvent) { - let popover = this.popoverCtrl.create(PopoverLongListPage); + let popover = this.popoverCtrl.create(PopoverLongListPage, {}, { + cssClass: 'my-popover popover-class' + }); popover.present({ ev: ev });