docs($routeProvider): Document resolved values#11413
docs($routeProvider): Document resolved values#11413fredsa wants to merge 1 commit intoangular:masterfrom
Conversation
Document that resolved values are available in `$route.current.locals`
|
In what situation are they available? If you want them in the controller then they are available via injection. |
|
This is about the resolved promises provided in the 'resolve' map of the route. |
|
@fredsa even if those are available, why not using DI for them (all the locals are injectable to controllers defined on a route level)? Is it about a "big" number of locals to be injected? If so maybe we should say in the docs when one way of doing things "wins" over another? |
|
@pkozlowski-opensource AFAICT the resolved values are only available via Here's the code I'm using. Note the assignment of Note further: and: |
|
@petebacondarwin, @pkozlowski-opensource, are referring to controllers defined for the route (in which the resolved values can be injected). @fredsa, is referring to injecting resolved dependencies to other controllers (e.g. a parent controller), in which case I think the route's I believe that (although undocumented) |
|
BTW, if we decide to document the ability to access resolved dependencies via |
|
I don't think that accessing resolves from an arbitrary controller is a good pattern to follow:
That being said, if you are trying to set up a global route change success handler, from inside a service, then I guess you might want to access the resolves. In this case you would indeed use |
|
So, agreeing with @gkalpak, I would rather document this in the |
…n `current` route Closes #11413
…n `current` route Closes angular#11413
…n `current` route Closes angular#11413
Document that resolved values are available in
$route.current.locals