diff --git a/src/ngRoute/route.js b/src/ngRoute/route.js index 1842948b1737..638be334023a 100644 --- a/src/ngRoute/route.js +++ b/src/ngRoute/route.js @@ -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. @@ -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. * @@ -260,7 +269,7 @@ 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: @@ -268,6 +277,9 @@ function $RouteProvider() { * - `$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