loading.service.ts 594 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { Injectable } from '@angular/core';
import { LoadingController } from '@ionic/angular';

@Injectable({
  providedIn: 'root'
})
export class LoadingService {
  loaderToShow: any;

  constructor(
    public loadingController: LoadingController
  ) {
  }

  showLoader(message = 'loading...') {
    this.loaderToShow = this.loadingController.create({
      message: message
    }).then((res) => {
      res.present();

      res.onDidDismiss().then((dis) => {
22
        //console.log('Loading dismissed!');
23
24
25
26
27
28
29
30
      });
    });
  }

  hideLoader() {
    this.loadingController.dismiss();
  }
}