Part of the application I am building is a multi step form/apply flow and I need to prevent the user from going back to the previous step on some routes. What is the best way to do this?
I've come across lots of SO questions that address this with canDeactivate but these basically just warn the use that going back will make you lose your information (Warn user of unsaved changes before leaving page)
How can I stop the angular router from routing if the user hits the browser back button. Or, is this the wrong design pattern and I should treat backward navigation differently?
Is this an acceptable solution? On the component you want to prevent backwards navigation on, add this to ngonInit
history.pushState(null, null, location.href);
window.onpopstate = function(event) {
history.go(1);
};