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

Commit

Permalink
fix($route): make nextRoute.$route private
Browse files Browse the repository at this point in the history
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
  • Loading branch information
IgorMinar committed Mar 8, 2013
1 parent cb5ce98 commit 6f71e80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ng/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ function $RouteProvider(){
var next = parseRoute(),
last = $route.current;

if (next && last && next.$route === last.$route
if (next && last && next.$$route === last.$$route
&& equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) {
last.params = next.params;
copy(last.params, $routeParams);
Expand Down Expand Up @@ -477,7 +477,7 @@ function $RouteProvider(){
match = inherit(route, {
params: extend({}, $location.search(), params),
pathParams: params});
match.$route = route;
match.$$route = route;
}
});
// No route matched; fallback to "otherwise" route
Expand Down

0 comments on commit 6f71e80

Please sign in to comment.