I need to customize how my URLs are encoded when calling the navigate
method on the router.
I know I need to implement my own version of UrlSerializer
and write a custom serialize
method. My problem is really that the only method I wish to change is the encode
method in url_tree
.
export function encode(s) {
return encodeURIComponent(s);
}
https://github.com/angular/angular/blob/master/modules/@angular/router/src/url_tree.ts#L344
In order to do this I need to copy + paste all the following methods from url_tree
into my CustomSerializer
because they are not exported:
serialize
serializeQueryParams
Pair
pairs
serializeSegment
encode
I've looked at this answer but it doesn't quite solve my problem as I want all the default behaviour except for the encode
method.
Am I missing something here or is there a better way to solve this issue?