I am trying to reload the current page in Angular.
So when I reload the page, my root component is called and this line is executed:
console.log(this.router.routerState.snapshot.url)
which prints "/component-x"
and then I execute this line of code:
this.router.navigate(['/component-x]')
And it does not work and I am logged out of my application.
Is navigating to the current route in Angular supported? And how else can I achieve reloading the current page?
Note my application is being hosted on Cloudfront on AWS, and I have rule set up that returns index.html when there is 404 error (i.e. when a page refresh occurs), and I have followed this guide around reloading the current route in Angular: https://medium.com/engineering-on-the-incline/reloading-current-route-on-click-angular-5-1a1bfc740ab2
But it is still not working. Can somebody please point out what I am missing?
Thanks!