Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 6f71e80

Browse files
committed
fix($route): make nextRoute.$route private
the `nextRoute` object available in `$routeChangeStart` handler accidentaly leaked property which pointed to the route definition currently being matched. this was done just for the internal needs of the `$route` implementation and was never documented as public api. Some confusion arouse around why the $route property was not always available on the `nextRoute` object (see #1907). The right thing for us to do is to prefix the property with $$ for now and refactor the code to remove the property completely in the future. Application developers should use the `nextRoute` object itself rather than its `$route` property. The main diff is that nextRoute inherits from the object referenced by $route. BREAKING CHANGE: in $routeChangeStart event, nextRoute.$route property is gone. Use the nextRoute object instead of nextRoute.$route. Closes #1907
1 parent cb5ce98 commit 6f71e80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ng/route.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ function $RouteProvider(){
397397
var next = parseRoute(),
398398
last = $route.current;
399399

400-
if (next && last && next.$route === last.$route
400+
if (next && last && next.$$route === last.$$route
401401
&& equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) {
402402
last.params = next.params;
403403
copy(last.params, $routeParams);
@@ -477,7 +477,7 @@ function $RouteProvider(){
477477
match = inherit(route, {
478478
params: extend({}, $location.search(), params),
479479
pathParams: params});
480-
match.$route = route;
480+
match.$$route = route;
481481
}
482482
});
483483
// No route matched; fallback to "otherwise" route

0 commit comments

Comments
 (0)