by guac · 13y ago · 0 comments
It should be noted than you can inject providers themselves in .config. Most users do this with built-in $routeProvider (which provides $route).
It's not mentioned in the post but he could pass "awesomeProvider" into module.config and (if it was more interesting than just a $get method) do something with it during the config phase.
With $routeProvider you would use the .when method to configure angular routing. It's .$get method returns the $route instance.
Do you have a fiddle or plunk that shows this working?
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.