I'm using ionic 3.. and in my file called services.ts
I have these 2 functions to show(createLoader
) / hide (cerrarLoading
) my loading
.
.
.
@Injectable()
export class ServicesProvider {
loading: any;
.
.
}
constructor(
public loadingCtrl: LoadingController,
) {}
createLoader(message: string = MESSAGES.loading.message) {
this.loading = this.loadingCtrl.create({
content: message
});
this.loading.present();
}
//close loading
cerrarLoading() {
this.loading.dismiss();
}
in my component:
constructor(
public ServicesProvider: ServicesProvider,
) {
setTimeout(function(){
this.ServicesProvider.createLoader();
},10000)
setTimeout(function(){
this.ServicesProvider.cerrarLoader();
},15000)
}
I pretend with that, show it before consuming a web service, and remove it when I have an answer to the request. before these lines, I have already created createLoader
and works, and I suspect that after using it (in the code I have set, for the first time I would use cerrarLoader()
), I am getting these errors.