Skip to content

Commit

Permalink
ADD: Added support for image for spinner.
Browse files Browse the repository at this point in the history
  • Loading branch information
rspl-yuvraj committed Mar 5, 2020
1 parent d5e710e commit cf48158
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 4 additions & 3 deletions projects/ngx-spinner/src/lib/ngx-spinner.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<div [@fadeIn]="'in'" *ngIf="spinner.show" class="overlay" [style.background-color]="spinner.bdColor" [style.z-index]="spinner.zIndex"
[style.position]="spinner.fullScreen ? 'fixed' : 'absolute'">
<div [class]="spinner.class" [style.color]="spinner.color">
<div [@fadeIn]="'in'" *ngIf="spinner.show" class="overlay" [style.background-color]="spinner.bdColor"
[style.z-index]="spinner.zIndex" [style.position]="spinner.fullScreen ? 'fixed' : 'absolute'">
<div *ngIf="!template" [class]="spinner.class" [style.color]="spinner.color">
<div *ngFor="let index of spinner.divArray"></div>
</div>
<div *ngIf="template" [innerHTML]="template"></div>
<div class="loading-text" [style.z-index]="spinner.zIndex">
<ng-content></ng-content>
</div>
Expand Down
8 changes: 8 additions & 0 deletions projects/ngx-spinner/src/lib/ngx-spinner.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ export class NgxSpinnerComponent implements OnDestroy, OnInit, OnChanges {
* @memberof NgxSpinnerComponent
*/
@Input() zIndex: number;
/**
* Custom template for spinner/loader
*
* @memberof NgxSpinnerComponent
*/
@Input() template: string;
/**
* Spinner Object
*
Expand Down Expand Up @@ -120,6 +126,7 @@ export class NgxSpinnerComponent implements OnDestroy, OnInit, OnChanges {
this.size = 'large';
this.fullScreen = true;
this.name = PRIMARY_SPINNER;
this.template = null;

this.divArray = [];
this.divCount = 0;
Expand Down Expand Up @@ -162,6 +169,7 @@ export class NgxSpinnerComponent implements OnDestroy, OnInit, OnChanges {
divCount: this.divCount,
show: this.show,
zIndex: this.zIndex,
template: this.template,
});
}
/**
Expand Down
2 changes: 2 additions & 0 deletions projects/ngx-spinner/src/lib/ngx-spinner.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export interface Spinner {
type?: string;
fullScreen?: boolean;
zIndex?: number;
template?: string;
}

export class NgxSpinner {
Expand All @@ -86,6 +87,7 @@ export class NgxSpinner {
fullScreen: boolean;
show: boolean;
zIndex: number;
template: string;

constructor(init?: Partial<NgxSpinner>) {
Object.assign(this, init);
Expand Down

0 comments on commit cf48158

Please sign in to comment.