Skip to content

Commit c9cec60

Browse files
committed
fix(router): fix for leading slash in dart
Using string1 === string2 translates to identical(string1, string2) in dart, which is incorrect as it is possilbe for dart strings to have different reference.
1 parent f356d03 commit c9cec60

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

modules/angular2/src/router/route_recognizer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class RouteRecognizer {
4343
StringMapWrapper.set(solution, 'params', pathRecognizer.parseParams(url));
4444

4545
//TODO(btford): determine a good generic way to deal with terminal matches
46-
if (url === '/') {
46+
if (url == '/') {
4747
StringMapWrapper.set(solution, 'matchedUrl', '/');
4848
StringMapWrapper.set(solution, 'unmatchedUrl', '');
4949
} else {

modules/angular2/test/router/route_recognizer_spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ export function main() {
3030
});
3131
});
3232

33+
it('should work with leading slash', () => {
34+
recognizer.addConfig('/', handler);
35+
36+
expect(recognizer.recognize('/')[0]).toEqual({
37+
'handler': { 'components': { 'a': 'b' } },
38+
'params': {},
39+
'matchedUrl': '/',
40+
'unmatchedUrl': ''
41+
});
42+
});
43+
3344
it('should work with a dynamic segment', () => {
3445
recognizer.addConfig('/user/:name', handler);
3546
expect(recognizer.recognize('/user/brian')[0]).toEqual({

0 commit comments

Comments
 (0)