How to remove history after submitting form?

I’m trying to remove history after submitting a form using,


after form is submitted. The problem is that, suppose if a form is at page2 after executing the statement, it will remove history prior to page2 but i want to remove history including page2 so that if a user is at page3 , he or she will not be able to go to page2. How can i achieve this behavior?

You can navigate to the new route, and add reloadAll to the route parameters to replace full router history. From docs:

reloadAll boolean
load new page and remove all previous pages from history and DOM