From 68ab2618d37c39b7347945c05c7d37b1638cab8a Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Tue, 9 Aug 2016 16:13:27 -0400 Subject: [PATCH] feat(action-sheet): add ability to pass multiple classes to cssClass references #7618 --- .../action-sheet/action-sheet-component.ts | 14 ++++++++++++-- src/components/action-sheet/test/basic/index.ts | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/action-sheet/action-sheet-component.ts b/src/components/action-sheet/action-sheet-component.ts index 1e2f9cb8b9c..48808d07ea3 100644 --- a/src/components/action-sheet/action-sheet-component.ts +++ b/src/components/action-sheet/action-sheet-component.ts @@ -47,7 +47,14 @@ import { ViewController } from '../nav/view-controller'; encapsulation: ViewEncapsulation.None, }) export class ActionSheetCmp { - private d: any; + private d: { + title?: string; + subTitle?: string; + cssClass?: string; + buttons?: Array; + enableBackdropDismiss?: boolean; + cancelButton: any; + }; private descId: string; private enabled: boolean; private hdrId: string; @@ -64,7 +71,10 @@ export class ActionSheetCmp { this.d = params.data; 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 = (++actionSheetIds); diff --git a/src/components/action-sheet/test/basic/index.ts b/src/components/action-sheet/test/basic/index.ts index ca93821ff81..4d596dfb77f 100644 --- a/src/components/action-sheet/test/basic/index.ts +++ b/src/components/action-sheet/test/basic/index.ts @@ -96,7 +96,8 @@ class E2EPage { this.result = 'Destructive'; } } - ] + ], + cssClass: 'my-action-sheet another-action-sheet-class' }); actionSheet.present(actionSheet);