ionicLoading not working


#1

Any Idea what could be wrong ?

[$injector:unpr] Unknown provider: $ionicLoading
http://errors.angularjs.org/1.2.22/$injector/unpr?p0=%24ionicLoading
http://192.168.1.106:8100/lib/angular/angular.js:3792:86
getService@http://192.168.1.106:8100/lib/angular/angular.js:3920:46
invoke@http://192.168.1.106:8100/lib/angular/angular.js:3947:23
http://192.168.1.106:8100/lib/angular/angular.js:3875:42
forEach@http://192.168.1.106:8100/lib/angular/angular.js:325:22


var intercept = angular.module('services.interceptor', [
   'ionic'
]);



intercept.config(function ($httpProvider, $ionicLoading) {

    $httpProvider.interceptors.push(function ($q, $ionicLoading) {
        return {
            responseError: function (rejection) {
                if (rejection.status == 0) {
                    $ionicLoading.show(
                        {
                            template: "Unable to process request. Probably connection is down.",
                            duration:3000
                        }
                    );
                }
                return $q.reject(rejection);
            }
        };
    });
});

#2

one findings, that it does work when injected inside controller and run method but not in the config.

So it looks like the only way to sort this out if I want to still utilize this ionicLoader on global level is to
have interceptor only broadcast a event lets say.: app.network.error, msg and in the RUN listen on this and there show a $ionicLoading

-Fk


#3

the problem is in config you can only use providers and not factories/controllers etc.
I would try using the $injector, or as you said with broadcast.

there is a similar post here:


here an other ressource:


#4

Cool. Yepa I figured that i can call $injector from this post but at the end I liked this broadcast thing’-)