Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/router/src/url_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ class UrlParser {

// if is is not one of these characters, then the segment was unescaped
// or the group was not closed
if (next !== '/' && next !== ')' && next !== ';') {
if (next !== '/' && next !== ')' && next !== ';' && next !== '(') {
throw new RuntimeError(
RuntimeErrorCode.UNPARSABLE_URL,
(typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot parse url '${this.url}'`,
Expand Down
15 changes: 15 additions & 0 deletions packages/router/test/url_tree.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ describe('UrlTree', () => {
const tree = serializer.parse('/path/to?first=http://foo/bar?baz=true&second=123');
expect(tree.queryParams).toEqual({'first': 'http://foo/bar?baz=true', 'second': '123'});
});

it('should parse a url with outlet and children', () => {
const url =
'/Home(app:Welcome//dock:left(1:One;pinned//2:Two;below=1//3:Three;pinned;above=2//4:Four))';
const tree = serializer.parse(url);
const dock = tree.root.children['dock'];
const dockChildren = dock.children;
expect(dockChildren['1'].segments[0].path).toEqual('One');
expect(dockChildren['1'].segments[0].parameters).toEqual({pinned: ''});
expect(dockChildren['2'].segments[0].path).toEqual('Two');
expect(dockChildren['2'].segments[0].parameters).toEqual({below: '1'});
expect(dockChildren['3'].segments[0].path).toEqual('Three');
expect(dockChildren['3'].segments[0].parameters).toEqual({pinned: '', above: '2'});
expect(dockChildren['4'].segments[0].path).toEqual('Four');
});
});

describe('containsTree', () => {
Expand Down