1
.config(['$provide', function ($provide) {
    $provide.decorator('$log', [
        '$delegate',
        function $logDecorator($delegate) {
            console.log("delegaete")
            var originalWarn = $delegate.warn;
            $delegate.warn = function decoratedWarn(msg) {
                msg = 'Decorated Warn: ' + msg;
                originalWarn.apply($delegate, arguments);
            };

            return $delegate;
        }
    ]);
    console.log("config")
}]);

Now as we know that in config phase services are not instantiated. $provide is also a service. Then how come we use it in config phase.?

Another is now $deligate is the instance of the service. And we are writing the service in config function when its not instantiate. So how can we do that? can some one tell me the step by step bootstrapping process? When this .decorate call?After services get instantiated????

BIG CONFUSION

Waleed Iqbal
  • 1,308
  • 19
  • 35
Subhadeep
  • 257
  • 5
  • 13
  • Possible duplicate of [Inject service in app.config](http://stackoverflow.com/questions/15937267/inject-service-in-app-config) – Pop-A-Stash Nov 15 '16 at 15:26

0 Answers0