Shivesh S
Shivesh S

Reputation: 1

not able to render the request to another html from controller using angularjs

I have a page A. On Submit of it, it need to render Page B with the values entered on PAge A. Page A is mapped to a controller A and on click event i am invoking Spring controller for rendering the Page B.

Issue is i am not able to fetch Page A details and show up on Page B. I tried shared service, but as soon as it reaches Page B controller, it becomes undefined.

Help is much appreciated.

Upvotes: 0

Views: 117

Answers (2)

Pratik Bhajankar
Pratik Bhajankar

Reputation: 1154

If you are using routing concept of angular js then in rootscope you can store that data but if you submit the page then angular scope is loss then ultimately you will get the undefined data.

because angular js is used for single page application. optional solution is you can store it in a localstorage of html5 or send the data with the request and and reused it.

i.e when you are calling the request which return page B then with request you can send the data to server then return this data with response of the spring request but then you have to send json response.

Upvotes: 1

manoj
manoj

Reputation: 3791

try using $rootscope

set the values to rootscope in the first controller and read it from the second controller.

upgrade your navigations to use route so that you can send some parameters as routeparams also

writing to the local storage is also an approach if your design allows so.

Upvotes: 1

Related Questions