Every time I make an http request, I want to show a ionicLoading dialog and then hide it when the request completes. I think the DRYest way to do this is as an interceptor (so I don’t have to repeat the show() and hide() function calls around every $http.get …
I have same issue with service you have write with $ionicPopup. Bu I also having same injection error. What is the right way to using $ionicLoading or $ionicPopup with service or not.
You can use a service or inject it directly. I wanted to use a service so that I could default some common values without having to define them every time.
@james_dn Actually I was also doing the same thing and got this error. As you said in the post we dont have to call .show and .hide everytime when we make ajax request. But in the solution provided my @keithdmoore the circular dependency issue is solved but again we have to call $injector.get("$ionicLoading").show(); and $injector.get("$ionicLoading").hide(); before and after the http request.
Also, $injector.get("$ionicLoading").show() can be called from controller ? I am calling from controller before I request for the http service.
Then you don’t have to worry about calling the show() and hide for every HTTP request. $injector is widely used to resolve circular dependency issues by the way.