Skip to content

Commit 2f1ebef

Browse files
fix($urlRouter): revert BC: resolve clashing of routes
This reverts commit b5c57c8. Closes #2501 Closes #2496
1 parent c4b30ef commit 2f1ebef

File tree

3 files changed

+1
-21
lines changed

3 files changed

+1
-21
lines changed

Diff for: src/urlRouter.js

-6
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,6 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
305305
return listener;
306306
}
307307

308-
rules.sort(function(ruleA, ruleB) {
309-
var aLength = ruleA.prefix ? ruleA.prefix.length : 0;
310-
var bLength = ruleB.prefix ? ruleB.prefix.length : 0;
311-
return bLength - aLength;
312-
});
313-
314308
if (!interceptDeferred) listen();
315309

316310
return {

Diff for: test/stateSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe('state', function () {
111111
}
112112
})
113113
.state('resolveTimeout', {
114-
url: "/:foo",
114+
url: "/resolve-timeout/:foo",
115115
resolve: {
116116
value: function ($timeout) {
117117
return $timeout(function() { log += "Success!"; }, 1);

Diff for: test/urlRouterSpec.js

-14
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ describe("UrlRouter", function () {
5555
return path.replace('baz', 'b4z');
5656
}).when('/foo/:param', function($match) {
5757
match = ['/foo/:param', $match];
58-
}).when('/foo/bar', function($match) {
59-
match = ['/foo/bar', $match];
6058
}).when('/bar', function($match) {
6159
match = ['/bar', $match];
6260
});
@@ -73,18 +71,6 @@ describe("UrlRouter", function () {
7371
});
7472
});
7573

76-
it("should handle more specified url first", function() {
77-
location.path("/foo/bar");
78-
scope.$emit("$locationChangeSuccess");
79-
expect(match[0]).toBe("/foo/bar");
80-
expect(match[1]).toEqual({});
81-
82-
location.path("/foo/baz");
83-
scope.$emit("$locationChangeSuccess");
84-
expect(match[0]).toBe("/foo/:param");
85-
expect(match[1]).toEqual({param: 'baz'});
86-
});
87-
8874
it("should execute rewrite rules", function () {
8975
location.path("/foo");
9076
scope.$emit("$locationChangeSuccess");

0 commit comments

Comments
 (0)