Home:ALL Converter>Angular 2 Routing - Hide URL

Angular 2 Routing - Hide URL

Ask Time:2017-03-24T19:44:50         Author:mast3rd3mon

Json Formatter

I know that you can hide the URL when routing using this.router.navigate(["/Pages"], { skipLocationChange: true }); but when i use window.open("/Pages") it has the URL.

Is there any way to hide the URL when using window.open() or a way to use the angular2 router to open the URL in a new tab?

Author:mast3rd3mon,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/42998677/angular-2-routing-hide-url
Spitzbueb :

You can inject the Location like this:\n\nconstructor(private readonly location: Location) {\n //...\n}\n\n\nAnd then in ngOnInit() run this:\n\npublic ngOnInit(): void {\n this.location.replaceState(\"/\");\n}\n\n\nThis replaced the URL in the browser with the URL you specify in replaceState().",
2017-07-14T10:56:03
yy