Devesh Jadon
Devesh Jadon

Reputation: 7464

Handle Exceptions while navigating to a route - Angular2

I am facing an issue with my application, whenever i click on any routerLink there is a rare case under which an exception arises and my app stops working until i reload it. Please suggest me a way to handle that exception and reload my app when it arises. Thankyou.

Upvotes: 2

Views: 64

Answers (1)

Tarun Gupta
Tarun Gupta

Reputation: 6403

You can have a new navigation method which will override the existing one and there you can use exception handling (try/ catch). Now you can catch the exception thrown by angular/javascript and reload you page.

Upvotes: 2

Related Questions