Search code examples
angularangular7-router

skipLocationChange: true is not working ; shows URL


I am very new to angular and don't know how to ask this question. I am facing an issue when I redirect to another component using router, skipLocationChange: true still shows current (called) component URL in browser,

syntax for router is as below

this.myRouter.navigate(['test-component2',{skipLocationChange:true}])

and it return http://localhost:4200/test-component2;skipLocationChange=true in the browser. Issue is also reported as bug here. Is there any alternative to it or any solution of current issue


Solution

  • Looks like a syntax mistake to me. Try:

    this.myRouter.navigate(['test-component2'],{skipLocationChange:true});