angular - Angular2 Router URL breaks at & -


after updated latest angular v4.3.2 urls break @ & value, example have route /:value want value from:

http://localhost:4200/one&two

but redirects me to:

http://localhost:4200/one

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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -