I recently asked how to get errors js in Angular 1.6 but now I'm having a problem trying to inject $http
to factory
. I get the following error:
Circular dependency found: $rootScope <- $http <- $exceptionHandler <- $rootScope <- $route
And this was what I was doing so far:
var app = angular.module("app", []);
app
.controller("ctrl", function($scope) {
// controller
})
.factory('$exceptionHandler', ['$log', '$http', function($log, $http) {
return function myExceptionHandler(exception, cause) {
$log.warn(exception, cause);
// muestro sólo esto y ya tira error
console.log($http);
}
}]);