Skip to content

Commit

Permalink
docs($routeProvider): document resolveAs and assiging resolve map…
Browse files Browse the repository at this point in the history
… on scope

Relate to angular#13400.
  • Loading branch information
gkalpak committed Dec 10, 2015
1 parent e4e5677 commit 44fe47c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/ngRoute/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ function $RouteProvider() {
* If all the promises are resolved successfully, the values of the resolved promises are
* injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is
* fired. If any of the promises are rejected the
* {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. The map object
* is:
* {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired.
* For easier access to the resolved dependencies from the template, the `resolve` map will
* be available on the scope of the route, under `$resolve` (by default) or a custom name
* specified by the `resolveAs` property (see below).
* **Note:** If your scope already contains a property with this name, it will be hidden or
* overwritten. Make sure, you specify an appropriate name for this property, that
* does not collide with other properties on the scope.
* The map object is:
*
* - `key` – `{string}`: a name of a dependency to be injected into the controller.
* - `factory` - `{string|function}`: If `string` then it is an alias for a service.
Expand All @@ -111,6 +117,9 @@ function $RouteProvider() {
* `ngRoute.$routeParams` will still refer to the previous route within these resolve
* functions. Use `$route.current.params` to access the new route parameters, instead.
*
* - `resolveAs` - {string=} - The name under which the `resolve` map will be available on the
* scope of the route. If omitted, defaults to `$resolve`.
*
* - `redirectTo` – {(string|function())=} – value to update
* {@link ng.$location $location} path with and trigger route redirection.
*
Expand Down Expand Up @@ -260,14 +269,17 @@ function $RouteProvider() {
* @property {Object} current Reference to the current route definition.
* The route definition contains:
*
* - `controller`: The controller constructor as define in route definition.
* - `controller`: The controller constructor as defined in the route definition.
* - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
* controller instantiation. The `locals` contain
* the resolved values of the `resolve` map. Additionally the `locals` also contain:
*
* - `$scope` - The current route scope.
* - `$template` - The current route template HTML.
*
* The `locals` will also be assigned to the controller's `$resolve` property. You can
* override the property name using `resolveAs` in the route definition.
*
* @property {Object} routes Object with all route configuration Objects as its properties.
*
* @description
Expand Down

0 comments on commit 44fe47c

Please sign in to comment.