Saving Form Field Values on Back Button

The back button works like a cancel, but I’ve got a case where I’d like to persist some form field values when the user goes back. localStorage is an option, but I’m wondering if there’s a better way.

To further describe what I’m looking for:

  1. Screen 1: user fills out Form A, then taps “next”
  2. Screen 2: user fills out the form, but needs to change something on Screen 1 so they hit “back”

How do I avoid losing all of the form values on screen 2?

store them in a service --> services are not state-dependend.

So create an own service --> in your controllers of your screens you can listen on “stateChangeStart”-event of the ui-router (everytime you try to leave the page)

–> store the values of the screen in the service. If you enter the screen again (listen on $ionicView.beforeEnter event)
you can check if there are data for the screen in your service --> get them

Thanks for the ideas. I’ll give them a try.