Skip to content

Commit

Permalink
feat(popover): add ability to pass multiple classes to cssClass
Browse files Browse the repository at this point in the history
references #7618
  • Loading branch information
brandyscarney committed Aug 9, 2016
1 parent 93898bb commit a685cdc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/components/popover/popover-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/components/popover/test/basic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down

0 comments on commit a685cdc

Please sign in to comment.