Skip to content

Commit a685cdc

Browse files
committed
feat(popover): add ability to pass multiple classes to cssClass
references #7618
1 parent 93898bb commit a685cdc

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/components/popover/popover-component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ import { ViewController } from '../nav/view-controller';
3434
export class PopoverCmp {
3535
@ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef;
3636

37-
private d: any;
37+
private d: {
38+
cssClass?: string;
39+
showBackdrop?: boolean;
40+
enableBackdropDismiss?: boolean;
41+
};
3842
private enabled: boolean;
3943
private id: number;
4044
private showSpinner: boolean;
@@ -50,7 +54,10 @@ export class PopoverCmp {
5054
this.d = _navParams.data.opts;
5155

5256
if (this.d.cssClass) {
53-
_renderer.setElementClass(_elementRef.nativeElement, this.d.cssClass, true);
57+
this.d.cssClass.split(' ').forEach(cssClass => {
58+
// Make sure the class isn't whitespace, otherwise it throws exceptions
59+
if (cssClass.trim() !== '') _renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
60+
});
5461
}
5562

5663
this.id = (++popoverIds);

src/components/popover/test/basic/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ class E2EPage {
189189
}
190190

191191
presentLongListPopover(ev: UIEvent) {
192-
let popover = this.popoverCtrl.create(PopoverLongListPage);
192+
let popover = this.popoverCtrl.create(PopoverLongListPage, {}, {
193+
cssClass: 'my-popover popover-class'
194+
});
193195
popover.present({
194196
ev: ev
195197
});

0 commit comments

Comments
 (0)