Skip to content

Commit

Permalink
feat(loading): 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 68ab261 commit 466dea3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/components/loading/loading-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ import { ViewController } from '../nav/view-controller';
encapsulation: ViewEncapsulation.None,
})
export class LoadingCmp {
private d: any;
private d: {
spinner?: string;
content?: string;
cssClass?: string;
showBackdrop?: boolean;
dismissOnPageChange?: boolean;
delay?: number;
duration?: number;
};
private id: number;
private showSpinner: boolean;
private durationTimeout: number;
Expand All @@ -47,7 +55,10 @@ export class LoadingCmp {
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 = (++loadingIds);
Expand Down
2 changes: 1 addition & 1 deletion src/components/loading/test/basic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class E2EPage {
presentLoadingDefault() {
let loading = this.loadingCtrl.create({
content: 'Please wait...',
cssClass: 'fixed-spinner'
cssClass: 'fixed-spinner spinner-class'
});

loading.present();
Expand Down

0 comments on commit 466dea3

Please sign in to comment.