Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49076

$ionicLoading doesn't show on device

$
0
0

@ln206 wrote:

Hello all,

$ionicLoading works fine on browser (ionic serve), but when I test it on my device (HTC One M8), it doesn't show up, could anyone explain why?

Basically, I followed the tutorial here http://learn.ionicframework.com/formulas/loading-screen-with-interceptors/,

I'm trying to get a loading shows up for every http request. Here's the code in my .run function

  $rootScope.$on('loading:show', function() {
       $ionicLoading.show({
          template: '<span style="color: #ffffff;">Loading...</span>'
       })
  });

  $rootScope.$on('loading:hide', function() {
        $ionicLoading.hide()
  });

And here's the code in my .config function

$httpProvider.interceptors.push(function($rootScope) {
  return {
    request: function(config) {
      $rootScope.$broadcast('loading:show');
      return config;
    },
    response: function(response) {
      $rootScope.$broadcast('loading:hide');
      return response;
    }
  }
});

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49076

Trending Articles