Ionic 4 show native spinner dialog

Install the Cordova and Ionic Native plugins:

ionic cordova plugin add cordova-plugin-native-spinner 
npm install --save @ionic-native/spinner-dialog@beta

Add this plugin to your app's module

import { SpinnerDialog } from '@ionic-native/spinner-dialog/ngx';

providers: [
     NativeStorage,
     StatusBar,
     SplashScreen,
     SpinnerDialog
]

Add below code in your component:

import { SpinnerDialog } from '@ionic-native/spinner-dialog/ngx';

constructor(private spinnerDialog: SpinnerDialog) {
             ... 

              this.spinnerDialog.show();
}

To hide this spinner you can use below code:

this.spinnerDialog.hide();

No comments:

Post a Comment