I
I
Isherath2018-07-07 10:08:46
Angular
Isherath, 2018-07-07 10:08:46

Save $scope when navigating through pages. How?

There is ONE controller. There are TWO pages. They have the same controller. The controller has a scope. On the first page, user data is entered and written to the scope of the controller. When you go to the second page and then click on the button, you need to transfer the data of this scope to the server.
How to do this - I have no idea. What to read - I do not know. Tell me, please, how to solve this problem? You just need to transfer data from one page to another. SessionStorage does not help, the array that I write to it from the first page turns out to be empty on the second page. Also, $rootScope doesn't work either.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BarryHAllen, 2018-07-09
@BarryHAllen

$rootScope cannot fail. This is the same $scope only global for the entire module. Most likely the problem is in your code)
You can write a service that will store the data you need and connect it to any number of necessary controllers.
But from what I've read - it will be easier for you to use $rootScope

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question