Hi,
I'm using the decorator to decorate the $log and the $exceptionHandler services and I want to set the logger level and some other stuff in the log decorator base on configuration that I retrieve from the server,
The configuration from the server is being retrieved by using the resolve of $routeProvider
templateUrl: 'pages/home.html',
controller: 'HomeCtrl',
resolve: {
myConfig: function (appConfig) {
return appConfig.retreiveConfig();
}
}
I tried to $rootScope.$broadcast an event when I retrieve the config from the server and use $injector.get('$rootScope'); inside the log decorator , like this
var $rootScope = $injector.get('$rootScope');
$rootScope.$on('app-config-loaded', function (event, one, two) {
console.log('heard something...');
});
But I'm getting Uncaught Error: [$injector:cdep] Circular dependency found: $log <- $exceptionHandler <- $rootScope
How can I use the configuration loaded in the routing resolve inside my $log decorator ?