Created
January 17, 2017 19:07
-
-
Save KerryRitter/d9c3391df80637aa155d7a74b9607741 to your computer and use it in GitHub Desktop.
Angular Loading service using Bootstrap UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Inject, Service } from "core/decorators"; | |
@Service("loadingService") | |
export class LoadingService { | |
private _modal: ng.ui.bootstrap.IModalServiceInstance; | |
constructor( | |
@Inject("$uibModal") private _modalService: ng.ui.bootstrap.IModalService | |
) { | |
} | |
public show(): void { | |
this._modal = this._modalService.open({ | |
size: "sm", | |
template: ` | |
<div class="modal-body text-center"> | |
<h3>Loading...</h3> | |
<div class="spinner" style="margin: 20px auto 0;"></div> | |
</div> | |
` | |
}); | |
} | |
public hide(): void { | |
this._modal.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment