File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ function $RouteProvider(){
2424 * route definition.
2525 *
2626 * `path` can contain named groups starting with a colon (`:name`). All characters up to the
27- * next slash are matched and stored in `$routeParams` under the given `name` when the route
28- * matches .
27+ * next slash are matched and stored in `$routeParams` under the given `name` after the route
28+ * is resolved .
2929 *
3030 * @param {Object } route Mapping information to be assigned to `$route.current` on route
3131 * match.
@@ -50,7 +50,9 @@ function $RouteProvider(){
5050 * - `factory` - `{string|function}`: If `string` then it is an alias for a service.
5151 * Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected}
5252 * and the return value is treated as the dependency. If the result is a promise, it is resolved
53- * before its value is injected into the controller.
53+ * before its value is injected into the controller. Be aware that `ngRoute.$routeParams` will
54+ * still refer to the previous route within these resolve functions. Use `$route.current.params`
55+ * to access the new route parameters, instead.
5456 *
5557 * - `redirectTo` – {(string|function())=} – value to update
5658 * {@link ng.$location $location} path with and trigger route redirection.
Original file line number Diff line number Diff line change 1515 * The service guarantees that the identity of the `$routeParams` object will remain unchanged
1616 * (but its properties will likely change) even when a route change occurs.
1717 *
18+ * Note that the `$routeParams` are only updated *after* a route change completes successfully.
19+ * This means that you cannot rely on `$routeParams` being correct in route resolve functions.
20+ * Instead you can use `$route.current.params` to access the new route's parameters.
21+ *
1822 * @example
1923 * <pre>
2024 * // Given:
You can’t perform that action at this time.
0 commit comments