Instantly share code, notes, and snippets.

Embed
What would you like to do?
loader service
import {Injectable} from '@angular/core';
import {LoadingController} from 'ionic-angular';
export interface ILoaderParams {
message?: string;
time?: number;
dismissOnPageChange?: boolean
}
@Injectable()
export class LoaderService {
loader;
constructor(public loadingCtrl: LoadingController) {
}
show(param: ILoaderParams) {
this.loader = this.loadingCtrl.create({
content: param.message || "Please wait...",
duration: param.time,
dismissOnPageChange: param.dismissOnPageChange || true
});
this.loader.present();
}
hide() {
this.loader.dismiss();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment