[Fixed] How to clear navigation history in Angular router


I have a use case in which I need to clear the navigation history using angular router (so that hardware back button press does nnot take me to the previous page but homepage).
I have been looking around for a straightforward solution for this but haven’t found any.
I have suggestions of using nativescript but I don’t want to increase my bundle-size for this requirement.
Please advise if there is any inbuilt angular functionality I can use?


The only way I was able to make it work was by using NavContoller


This removed all the pages from the stack and navigated to the homepage

Leave a Reply

(*) Required, Your email will not be published