Passing data between views in ionic

I am working with the ionic framework to create a simple app. One of the pages in the app is a registration page. On this registration page I want to add a button that opens another page where the user can select a value, and the return to the previous page with that selected value.

I tried using the $stateParams, but I can not figure out how to do this properly in the $stateProvider. And setting the values as global seems rather evil to me.

What would be the easiest way to accomplish this?

you can use $state.go('yourTarget',{paramB:a,paramB:b} to send data by uiRouter,

Or just Use an angular Services for bridge your 2 controller.

We have used a local storage to store the value temporarily and deleted it after retrieving it in the controller.