Display a Loading Indicator/Spinner in Ionic 5 With LoadingController

Display a Loading Indicator/Spinner in Ionic 5 With LoadingController

In this post we will give you information about Display a Loading Indicator/Spinner in Ionic 5 With LoadingController. Hear we will give you detail about Display a Loading Indicator/Spinner in Ionic 5 With LoadingControllerAnd how to use it also give you demo for it if it is necessary.

In this tutorial, we’ll learn to how to display a Loading Indicator/Spinner in Ionic 5 With LoadingController.

Why Using the Loading Controller in your Ionic 5 App?

The user experience is considered as a very important factor for a successful mobile application. Among things that constitute a good user experience is visual feedback which means your users are getting feedback of what is going on with your app every time your app is working on some UI blocking task.

For example if you app is getting some data from a remote database (which may take a significant time) then you should display some visual indicator which tells your users to wait for data to be completely received and in the same time block the UI to prevent users from repeating actions or otherwise they may repeat actions that may cause the app to malfunction instead of waiting the completion of current task.

Ionic 5/Angular has a built-in service for blocking UI and giving visual feedback to users when the app is executing some time consuming activity on background such as loading data from a remote database.

You can simply use the LoadingController which is available from the @ionic/angular package.

Using LoadingController in Ionic 5 by Example

So start by importing LoadingController:

import { LoadingController } from 'ionic-angular';

Then inject it on the class constructor:

constructor(public loadingController:LoadingController){...}    let loading = this.loadingController.create({content : "Logging in ,please wait..."});    loading.present();    this.auth.login('basic', {'email':this.email, 'password':this.password}).then(()=>{        loading.dismissAll();    });

When you are successfully logged in, the dismissAll() method hides the loading indicator so you can continue interacting with your app normally.

Read the official Ionic 5 docs for LoadingController


Hope this code and post will helped you for implement Display a Loading Indicator/Spinner in Ionic 5 With LoadingController. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US