I am having a special condition where i need to redirect to a url and reload.
I am using this method from router:
this.router.navigateByUrl('login'); this.reload(); Where this.reload() is the function that is working outside the angular zone to force reload the page. I need to force reload as i don't have control with some assets coming from server.
The code of reload is:
public reload(): any { return this.zone.runOutsideAngular(() => { location.reload() }); } The issue is:
I am navigated to the login in the beginning and then the page is reloaded which is the default behavior.
Required output:
just navigate without rendering the component and reload like when we hit some unauthorized url we are redirected to the login page in most of the sites.
navigateByUrland instead replace the window'slocationproperty:location.replace('myUrl');