0

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.

You can check my flowchart below: flowchart

How can I achieve that?

You can check out my repo on github to fix this problem.

user3077416
  • 271
  • 2
  • 10
  • 31

1 Answers1

1

You have several options of that :

EASIEST BUT "dirty"

You can use $rootScope to store all you data and initialise them on each of controller.

Clean Solution parameters You can define ui-router parameters for each of the variables you want to send. See ui-router doc : https://github.com/angular-ui/ui-router/wiki/URL-Routing

using LocalStorage For persistance, you can use localStorage. It is clean and won't impact your routing ruleS.

Better solution, using a service See that explanation concerning data persistance and services : https://stackoverflow.com/a/12574818/3687474

I'll personnaly go for the service solution that is scalable, portable and testable

Community
  • 1
  • 1
aorfevre
  • 5,034
  • 3
  • 21
  • 51