I have angular application in which I need to reload page after navigation. I have applied this solution but window.location.reload();
does not work on production. So I have added useHash: true
in app-routing.module.ts
file. But that also giving me problems while applying SSR in application. So I need alternate way for below code:
this.router.navigate(['path/to'])
.then(() => {
window.location.reload();
});
I have tried by applying window.location.href = window.location.href
, window.location.href = window.location.protocol + '//' + window.location.host + '/path/to';
instead of window.location.reload();
but it does not reload the page as expected.
Is there any other way to achieve reloading after navigating in angular 12? Please help and guide.
Edit : Why reload: In application, after login of user, notifications are shown in header. That does not show data if page not reloaded.