question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: bug: $ionicLoading Not Being Removed

See original GitHub issue

Type: <span ionic-type>bug</span>

Platform: <span ionic-platform>android</span> <span ionic-platform-version>4.4</span> <span ionic-webview>webview</span>

<span ionic-description>Type: <span ionic-type>bug</span>

Platform: <span ionic-platform>android</span> <span ionic-platform-version>4.4</span> <span ionic-webview>webview</span>

<span ionic-description>Hi, I have a case where in my Resolve for a route, I get some data from the local DB.

resolve: {
    CategoriesList: ['Category', '$ionicLoading', function(Category, $ionicLoading) {
        $ionicLoading.show({
            template: 'Loading Categories',
            noBackdrop: true
        });

        return Category.getAllLocalCategories()
            .then(function(allLocalCategoriesSuccessData) {
                $ionicLoading.hide();
                return {
                    categories: allLocalCategoriesSuccessData,
                    success: true
                };

            }, function() {
                $ionicLoading.hide();
                return {
                    success: false
                };

            });
    }]
}

The code above shows how I handle my flow by showing the $ionicLoading and then hiding it asap I get something. This code has always worked since up until RC3. Updating to RC4 RC5 including Stable 1.0.0 seems to make sure that the $ionicLoading stays open. The funny part is it happens only on Android. On IOS the code works as normal but on Android (Both IONIC Serve & Ionic Device), It breaks. I have a video showing proof. </span>

<span is-issue-template></span> </span>

<span is-issue-template></span>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
ffabreticommented, Jun 17, 2015

I’ve had similar problem ( $ionicLoading.hide() not working ) when I implemented localStorage cache in my App. I have debugged with lots of console.logs everywhere because I had not a single error on the console. I came the the conclusion that retrieving cached data was so quick that $ionicLoading.hide() finishes execution before $ionicLoading.show().
What solved for me was: $timeout( function(){ $ionicLoading.hide()},100); I have seen this hack before on Titanium with Android, so I guess it has something to do with the way Android code is processed…

EDIT
If you do $ionicLoading.show({delay:100}) and then $ionicLoading.hide() it works, I mean, if the two calls are done very fast ( less then 100ms ) loading is never show, what is supposed to be expected. I think that the show call is registered and the hide call cancels it. Obviously! But when you do not use the delay option, the show call spends some time executing itself (async, my guess) while the hide call gets executed (and hides nothing) resulting loading to stay opened forever.

1reaction
pawan-mittalcommented, Feb 19, 2017

@ffabreti Thanks a lot. I was really struggling with this issue, but your solution saved my day.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: $ionicLoading Not Being Removed · Issue #3717 - GitHub
The code above shows how I handle my flow by showing the $ionicLoading and then hiding it asap I get something. This code...
Read more >
ionicLoading Bug - Ionic Forum
Hi sometimes (when you switch states really fast) , the ionic loading.hide is not removing the "loader-active" class from body element which makes...
Read more >
bug: bug: $ionicLoading Not Being Removed - - Bountysource
bug : bug: $ionicLoading Not Being Removed · Type: bug · Hi, I have a case where in my Resolve for a route,...
Read more >
Ionic 4: "Loading Controller" dismiss() is called before present ...
I tried to call the data inside "loadingController.present().then()", but that caused the data to be slower... is this a bug? how to solve...
Read more >
Dismissing All Loading Overlays in Ionic 4 - Damir's Corner
In Ionic 4, the dismissAll method for closing all currently open loading overlays has been removed. This might not be such a bad...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found