angular - Angular2 Router URL breaks at & -
after updated latest angular v4.3.2 urls break @ & value, example have route /:value want value from:
but redirects me to:
and since value url dynamic, many can have & cannot display correct result.
using customurlserializer managed replace %26 & , navigating thru router inside app works still @ initial page load url gets splitted:
import { urlserializer, urltree, defaulturlserializer } '@angular/router'; export class customurlserializer implements urlserializer { parse(url: any): urltree { const dus = new defaulturlserializer(); return dus.parse(url); } serialize(tree: urltree): { const dus = new defaulturlserializer(); const path = dus.serialize(tree); return path.replace(/%26/g, '&').replace(/%2b/g, '+'); } }
is there solution disable url breaking @ & ?
ok know & used special character inside router if need value , not split it:
edit: node_modules/@angular/router/@angular/router.es5.js
var segment_re = /^[^\/()?;=&#]+/; var query_param_re = /^[^=?&#]+/; var query_param_value_re = /^[^?&#]+/;
remove & regex , should work.
Comments
Post a Comment