Skip to content

Commit 68ab261

Browse files
committed
feat(action-sheet): add ability to pass multiple classes to cssClass
references #7618
1 parent a685cdc commit 68ab261

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/components/action-sheet/action-sheet-component.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ import { ViewController } from '../nav/view-controller';
4747
encapsulation: ViewEncapsulation.None,
4848
})
4949
export class ActionSheetCmp {
50-
private d: any;
50+
private d: {
51+
title?: string;
52+
subTitle?: string;
53+
cssClass?: string;
54+
buttons?: Array<any>;
55+
enableBackdropDismiss?: boolean;
56+
cancelButton: any;
57+
};
5158
private descId: string;
5259
private enabled: boolean;
5360
private hdrId: string;
@@ -64,7 +71,10 @@ export class ActionSheetCmp {
6471
this.d = params.data;
6572

6673
if (this.d.cssClass) {
67-
renderer.setElementClass(_elementRef.nativeElement, this.d.cssClass, true);
74+
this.d.cssClass.split(' ').forEach(cssClass => {
75+
// Make sure the class isn't whitespace, otherwise it throws exceptions
76+
if (cssClass.trim() !== '') renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
77+
});
6878
}
6979

7080
this.id = (++actionSheetIds);

src/components/action-sheet/test/basic/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ class E2EPage {
9696
this.result = 'Destructive';
9797
}
9898
}
99-
]
99+
],
100+
cssClass: 'my-action-sheet another-action-sheet-class'
100101
});
101102

102103
actionSheet.present(actionSheet);

0 commit comments

Comments
 (0)