# Strange flashing with $ionicLoading

**URL:** <https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920>\
**Category:** uncategorized\
**Created:** [March 16, 2014, 11:30pm UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920 "2014-03-16T23:30:51Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnanders](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@cnanders](https://forum.ionicframework.com/u/cnanders)\
**Post date:** [March 16, 2014, 11:30pm UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/1 "2014-03-16T23:30:51Z")

</div>

I’m on the nightly build. My goal is to show the loading overlay for a couple seconds while content loads. I wanted to use setTimeout() to delay hiding the overlay, like so:

```
// Show the loader (call a function like the one here: http://ionicframework.com/docs/angularjs/views/loading/
$scope.show();
 
// Tell the app to do stuff
 
// Delay hiding for 1500 ms	
setTimeout(function() {
		$scope.hide();
	}, 1500);

```

Unfortunately this caused strange “flashing” of the loading indicator. It would show the overlay for a split second, then go away, then after the 1500 ms timeout, would flash momentarily once more. I dug through the nightly-ionic.js and found this.

```
// Wait 'showDelay' ms before showing the loading screen
    this._showDelayTimeout = window.setTimeout(function() {
      _this.el.classList.add('active');
    }, _this.showDelay);

```

When I commented out the showDelay to just add the “active” class immediately when the method is evoked, everything worked fine. Just thought I’d point this out to the Ionic team. It seems strange to even have a showDelay for the loading indicator. Given that it causes these problems, it might be worth getting rid of it,

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [March 17, 2014, 3:25pm UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/2 "2014-03-17T15:25:17Z")

</div>

I’ve got 2 samples here that aren’t displaying the problem.

Can you fork one and modify it the way you have config’ed so we can see what’s happening?

0.9.27 : [http://codepen.io/calendee/pen/hEGIb/](http://codepen.io/calendee/pen/hEGIb/)

Nightly : [http://codepen.io/calendee/pen/vmqrH/](http://codepen.io/calendee/pen/vmqrH/)

---

<div class="post-metadata">

**Author:** ![cnanders](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@cnanders](https://forum.ionicframework.com/u/cnanders)\
**Post date:** [April 11, 2014, 4:50am UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/3 "2014-04-11T04:50:49Z")

</div>

@Calendee, thanks for the reply. Sorry I didn’t get back to you. I’ve checked into this a bit more. Here is what Ive found. If showDelay is set short enough (10 ms does it) and you also change states while the loader is showing, it flashes a lot of the time. I forked the “App Intro Walkthrough 1.0.0 beta” CodePen and it set it up to show the flashing behavior when you finish the walkthrough (just click “skip intro” in top left of app)

[http://codepen.io/cnanders/pen/rKuxy](http://codepen.io/cnanders/pen/rKuxy)

If you increase the showDelay property to \> 100 ms, the flashing is mitigated. Don’t know if that helps you solve the problem, but at least I found a way to make it reproducible.

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [April 11, 2014, 2:10pm UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/4 "2014-04-11T14:10:48Z")

</div>

Are you on a device or desktop browser when seeing this issue? I’m running it in Chrome & Canary and not seeing the problem.

![](https://sea1.discourse-cdn.com/ionicframework/uploads/default/460/7a28ff96739bb895.gif)

---

<div class="post-metadata">

**Author:** ![cnanders](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@cnanders](https://forum.ionicframework.com/u/cnanders)\
**Post date:** [April 11, 2014, 2:58pm UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/5 "2014-04-11T14:58:54Z")

</div>

@Calandee, I’m seeing it on desktop Safari 7.0.3. I just checked with Chrome 34.0 and it was not reproducible.

![](https://sea1.discourse-cdn.com/ionicframework/uploads/default/462/2328ebaaee566d09.gif)

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [April 11, 2014, 3:22pm UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/6 "2014-04-11T15:22:12Z")

</div>

Great. Ionic’s not really a desktop tool, but it is nice when it works there. I’d really like to know if you have this problem on device when wrapped in PhoneGap. Keep us posted.

---

<div class="post-metadata">

**Author:** ![dcollingwood](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@dcollingwood](https://forum.ionicframework.com/u/dcollingwood)\
**Post date:** [April 14, 2014, 1:24am UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/7 "2014-04-14T01:24:48Z")

</div>

I’ve also just started having issues with this. I have experienced this issue in both Safari and (more importantly) on iOS (7.1). Chrome is working fine as expected.

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [April 14, 2014, 3:17pm UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/8 "2014-04-14T15:17:40Z")

</div>

Okay, I’ve reproduced the bug.

If `showDelay` is less than about 200ms, you get the stutter flash. If `showDelay` is \> 200 ms, the stutter flash goes away. If `showDelay` is removed completely, the stutter flash comes back.

I’ve opened Issue # 1132 for this:

> <https://github.com/ionic-team/ionic/issues/1132>
>
> When the loading indicator is configured with a showDelay less than ?? 200 ms ??, the loading indicator displays then disappears...

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [April 14, 2014, 3:47pm UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/9 "2014-04-14T15:47:55Z")

</div>

FYI : This is fixed in the nightly if you use the NEW API.

![](https://sea1.discourse-cdn.com/ionicframework/uploads/default/475/dbd1dbcdc737f767.gif)

```auto
$ionicLoading.show({ 
	template : '<i class="icon ion-loading-d"></i>',
	delay : 5
});

```

---

<div class="post-metadata">

**Author:** ![kalimsayyad](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@kalimsayyad](https://forum.ionicframework.com/u/kalimsayyad)\
**Post date:** [May 8, 2014, 9:14am UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/10 "2014-05-08T09:14:48Z")

</div>

Is this issue fixed in (v1.0.0-beta.4 ‘antimony-antelope’) ?, If not is there any plan to fix this in the latest releases except nightly version.

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [May 8, 2014, 12:28pm UTC](https://forum.ionicframework.com/t/strange-flashing-with-ionicloading/1920/11 "2014-05-08T12:28:37Z")

</div>

See the issue that was linked above:

> Andy,

> I apologize. I should have tested that first thing.

> In the nightly with the OLD API, it still fails. In the nightly with the new API it does not fail.

> Justin
