fix(router): use encodeUri/decodeUri to encode fragment

This commit is contained in:
vsavkin
2016-08-25 06:08:07 -07:00
committed by Victor Berchet
parent 0bb516fae2
commit bb9dfbc578
2 changed files with 5 additions and 6 deletions

View File

@ -182,9 +182,8 @@ export class DefaultUrlSerializer implements UrlSerializer {
serialize(tree: UrlTree): string {
const segment = `/${serializeSegment(tree.root, true)}`;
const query = serializeQueryParams(tree.queryParams);
const fragment = tree.fragment !== null && tree.fragment !== undefined ?
`#${encodeURIComponent(tree.fragment)}` :
'';
const fragment =
tree.fragment !== null && tree.fragment !== undefined ? `#${encodeURI(tree.fragment)}` : '';
return `${segment}${query}${fragment}`;
}
}
@ -371,7 +370,7 @@ class UrlParser {
parseFragment(): string {
if (this.peekStartsWith('#')) {
return decode(this.remaining.substring(1));
return decodeURI(this.remaining.substring(1));
} else {
return null;
}