$stateChangeStart


#1

Hi. I’d like to ask how would I be able to show a loading indicator ($ionicLoading) everytime I change state during transition from one tab view to another?

For example I have this code:

//controller
scope.selectFriendsTab = function() {
        loadingIndicator.show();
        $state.go('tab.friends');
      };

//service
.service('loadingIndicator', [
    '$ionicLoading',
    function($ionicLoading) {
      this.show = function() {
        $ionicLoading.show({
          templateUrl: 'templates/loading.html'
        });
      };
      this.hide = function() {
        $ionicLoading.hide();
      };
    }
  ])

where loading.html contains the ionic icon for loading

but the loading indicator does not show. Am I missing something here?


#2

How do this work for you?