How do I update the LoadingController Content after it has been created


#1

Please am having a small challenge, I want to be able to update the content of my LoadingController after it has been created. What I actually wanted is a progress bar showing in the content, the content will be updated every 5seconds.

presentLoadingCustom() {
  let loading = this.loadingCtrl.create({
    spinner: 'hide',
    content: `
      <div class="custom-spinner-container">
        <div class="custom-spinner-box"></div>
      </div>`,
   
  });

On the documentation for LoadingController there is no way you can update the content after it has been created.

Please is there a way to update it?


#2

Looking forward for a solution aswell!


#3

Agreed - need the ability to show dynamic content on the loading screen. Is there a way?


#4

Looks like this (undocumented?) setContent() method seems to work. I had to execute this inside an ngZone.run() as suggested here:


#5

Create a service that listens to your download action, and then takes steps accordingly. There’s a progress bar component on Josh Morony’s blog, so that’s one place to look. I wouldn’t rely on unsupported loadingController methods. If a method isn’t official, it probably isn’t ready for prime time.


#6

There’s another progress bar implementation in the comments of ionic #6669.