Getting ID from previous page to update with new data on next page


#1

I have some data from first page (or “Data Form” page) that needs to be loaded on next page (or “Add More Info” page) with same ID from first page before any controller is executed in my ionic application with sqlite database. In next page (or “Add More Info” page), I want add some new data to previous data with same ID before return again to first page. Please check out my flow chart below:

Also I already make a script on github like I descibed above. I hope anyone can help me to solve this problem.


#2

I hope anyone can help me to solve this problem


#3

Hi, check this pattern called master-detail patern : http://mcgivery.com/ionic-master-detail-pattern/


#4

Thanks for replied. Could you fix my repo on github? Because I already add “$routeParams” method still didn’t work.


#5

If you are using $stateProvider in the configuration of your app you need to be using $stateParams to pass the data, not $routeParams.

In Ionic and Angular, this is typically achieved through the help of a service (or factory) and $routeParams or $stateParams, depending on which router you are using.

Take a look at this tutorial:
http://learn.ionicframework.com/formulas/sharing-data-between-views/


#6

@andrewmcgivery has updated the blog above to use $stateProvider and $stateParams, if you look at the blog posted by @MisterJack49 again, it should be what you need.