mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 21:15:24 +08:00
feat(popover): add ability to pass multiple classes to cssClass
references #7618
This commit is contained in:
@ -34,7 +34,11 @@ import { ViewController } from '../nav/view-controller';
|
|||||||
export class PopoverCmp {
|
export class PopoverCmp {
|
||||||
@ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef;
|
@ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef;
|
||||||
|
|
||||||
private d: any;
|
private d: {
|
||||||
|
cssClass?: string;
|
||||||
|
showBackdrop?: boolean;
|
||||||
|
enableBackdropDismiss?: boolean;
|
||||||
|
};
|
||||||
private enabled: boolean;
|
private enabled: boolean;
|
||||||
private id: number;
|
private id: number;
|
||||||
private showSpinner: boolean;
|
private showSpinner: boolean;
|
||||||
@ -50,7 +54,10 @@ export class PopoverCmp {
|
|||||||
this.d = _navParams.data.opts;
|
this.d = _navParams.data.opts;
|
||||||
|
|
||||||
if (this.d.cssClass) {
|
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);
|
this.id = (++popoverIds);
|
||||||
|
@ -189,7 +189,9 @@ class E2EPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
presentLongListPopover(ev: UIEvent) {
|
presentLongListPopover(ev: UIEvent) {
|
||||||
let popover = this.popoverCtrl.create(PopoverLongListPage);
|
let popover = this.popoverCtrl.create(PopoverLongListPage, {}, {
|
||||||
|
cssClass: 'my-popover popover-class'
|
||||||
|
});
|
||||||
popover.present({
|
popover.present({
|
||||||
ev: ev
|
ev: ev
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user