Let\'s say someone wrote a method like this in a file called app.js
trying to peform an XHR request angainst a non existing url:
app.controller(\'Ma
One option that came in my mind is to create a module for $http debugging that you can add it as a dependency in your main module whenever you need to debug $http calls. There a decorator for the $http service can be registered that will simply log the arguments of the call a forward it to the $http service. There a breakpoint can be set too.
I have created a simple working example here. I hope it will help.
Example $http logger decorator implementation:
var httpDebugging = angular.module('http-debugging', []);
httpDebugging.decorator('$http', function ($delegate) {
var debugAware = function (fnCallback) {
return function () {
var result = fnCallback.apply(this, arguments);
console.log('$http decorator: ', arguments);
return result;
};
};
for(var prop in $delegate) {
if (angular.isFunction($delegate[prop])) {
$delegate[prop] = debugAware($delegate[prop]);
}
}
return $delegate;
});