Ever since updating to the latest version of angular v4.3.2, I've encountered an issue where all my URLs break at the & value. For instance, I have a route /:value from which I need to retrieve the value:
Instead of directing me to the correct page, it redirects me to:
Since the value in the URL is dynamic and can contain &, I'm unable to display the accurate result.
Through the use of a CustomUrlSerializer, I was able to replace %26 with & and successfully navigate through the router within the application. However, during the initial page load, the URL still gets split:
import { UrlSerializer, UrlTree, DefaultUrlSerializer } from '@angular/router';
export class CustomUrlSerializer implements UrlSerializer {
parse(url: any): UrlTree {
const dus = new DefaultUrlSerializer();
return dus.parse(url);
}
serialize(tree: UrlTree): any {
const dus = new DefaultUrlSerializer();
const path = dus.serialize(tree);
return path.replace(/%26/g, '&').replace(/%2B/g, '+');
}
}
Is there a solution to prevent the URL from breaking at &?