I have an Angular interceptor working:
factory('myHttpInterceptor', function ($q, $location, $rootScope) {
// do something
return function (promise) {
return promise.then(function (response) {
// do something
return response;
}, function (response) {
// do something
return $q.reject(response);
});
};
})
and one big html file which contains templates like <script type="text/ng-template" id="home-template">
. Unfortunately my HTTP interceptor intercepts not only loading HTTP requests but also loading templates (which are already loaded in html file) for controllers which are defined like when('/', {controller:MainController, templateUrl:'home-template'})
. Is there a way how to make interceptor intercepting only HTTP requests or how to recognize whether I am loading something from server or just a template?