I am using angularJS in my SPA. I want to disable the default action of browser back button/android back button in my webapp and create custom actions for the same.
Example case: I have a signup page where user entries are saved as scope variables before submitting the form. An amazing fullscreen form lets user select the location, having a back button to hide the form (just in case). As a bad UX, whenever the user presses back button in mobile or browser, page is redirected to previous page in location.history. Also, location.history.forward() method reinitializes the controller, thus having user to fill everything again.
What could be the best possible working solution in given constraints?
No external libraries please