@@ -100,8 +100,17 @@ function $RouteProvider() {
100
100
* If all the promises are resolved successfully, the values of the resolved promises are
101
101
* injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is
102
102
* fired. If any of the promises are rejected the
103
- * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. The map object
104
- * is:
103
+ * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired.
104
+ * For easier access to the resolved dependencies from the template, the `resolve` map will
105
+ * be available on the scope of the route, under `$resolve` (by default) or a custom name
106
+ * specified by the `resolveAs` property (see below). This can be particularly useful, when
107
+ * working with {@link angular.Module#component components} as route templates.<br />
108
+ * <div class="alert alert-warning">
109
+ * **Note:** If your scope already contains a property with this name, it will be hidden
110
+ * or overwritten. Make sure, you specify an appropriate name for this property, that
111
+ * does not collide with other properties on the scope.
112
+ * </div>
113
+ * The map object is:
105
114
*
106
115
* - `key` – `{string}`: a name of a dependency to be injected into the controller.
107
116
* - `factory` - `{string|function}`: If `string` then it is an alias for a service.
@@ -111,7 +120,10 @@ function $RouteProvider() {
111
120
* `ngRoute.$routeParams` will still refer to the previous route within these resolve
112
121
* functions. Use `$route.current.params` to access the new route parameters, instead.
113
122
*
114
- * - `redirectTo` – {(string|function())=} – value to update
123
+ * - `resolveAs` - `{string=}` - The name under which the `resolve` map will be available on
124
+ * the scope of the route. If omitted, defaults to `$resolve`.
125
+ *
126
+ * - `redirectTo` – `{(string|function())=}` – value to update
115
127
* {@link ng.$location $location} path with and trigger route redirection.
116
128
*
117
129
* If `redirectTo` is a function, it will be called with the following parameters:
@@ -124,13 +136,13 @@ function $RouteProvider() {
124
136
* The custom `redirectTo` function is expected to return a string which will be used
125
137
* to update `$location.path()` and `$location.search()`.
126
138
*
127
- * - `[reloadOnSearch=true]` - {boolean=} - reload route when only `$location.search()`
139
+ * - `[reloadOnSearch=true]` - ` {boolean=}` - reload route when only `$location.search()`
128
140
* or `$location.hash()` changes.
129
141
*
130
142
* If the option is set to `false` and url in the browser changes, then
131
143
* `$routeUpdate` event is broadcasted on the root scope.
132
144
*
133
- * - `[caseInsensitiveMatch=false]` - {boolean=} - match routes without being case sensitive
145
+ * - `[caseInsensitiveMatch=false]` - ` {boolean=}` - match routes without being case sensitive
134
146
*
135
147
* If the option is set to `true`, then the particular route can be matched without being
136
148
* case sensitive
@@ -260,14 +272,18 @@ function $RouteProvider() {
260
272
* @property {Object } current Reference to the current route definition.
261
273
* The route definition contains:
262
274
*
263
- * - `controller`: The controller constructor as define in route definition.
275
+ * - `controller`: The controller constructor as defined in the route definition.
264
276
* - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
265
277
* controller instantiation. The `locals` contain
266
278
* the resolved values of the `resolve` map. Additionally the `locals` also contain:
267
279
*
268
280
* - `$scope` - The current route scope.
269
281
* - `$template` - The current route template HTML.
270
282
*
283
+ * The `locals` will be assigned to the route scope's `$resolve` property. You can override
284
+ * the property name, using `resolveAs` in the route definition. See
285
+ * {@link ngRoute.$routeProvider $routeProvider} for more info.
286
+ *
271
287
* @property {Object } routes Object with all route configuration Objects as its properties.
272
288
*
273
289
* @description
0 commit comments