Hacker News new | ask | show | jobs
by michaelw 4768 days ago
$routeProvider and $location are special in that can be injected into .config. It may be that they are actually implemented as special constants. I do not believe that non constant providers can be injected.

Do you have a fiddle or plunk that shows this working?

1 comments

How about this: http://jsfiddle.net/pJ8Mt/1/

It's a poor example since I couldn't think of anything useful off the top of my head but it shows how you might modify a service at config time by creating its provider yourself.

Also I believe .config executes immediately so the provider needs to be defined beforehand (in this case above .config, but probably better to define it in another module to ensure it's available at config time). When I defined it after .config angular complained it couldn't find awesomeProvider.