1

I use ui-router and ui-sref.

first page

<a id="XXX" ui-sref="app.page2">goto second page</a>

second page

<a ui-sref="app.page3">goto third page</a>

third page template or controller Here I should receive id XXX form button on the first page

Is there a way to pass a string between 3 pages?

Sergey Kudryashov
  • 713
  • 2
  • 9
  • 30
  • The answer to your question http://stackoverflow.com/questions/25647454/how-to-pass-parameters-using-ui-sref-in-ui-router-to-controller – Shamal Perera Sep 25 '15 at 09:55

2 Answers2

3

You can pass values through the ui-router this way:

<a ui-sref="app.page3({value: {{theValue}} })">goto third page</a>

This will work if you have theValue in scope. Replace the value to be passed along to suit your needs.

In your controller you can get the value through $state, like this: $state.params.value.

IKavanagh
  • 6,089
  • 11
  • 42
  • 47
0

If the value is static then you should be able to store this value in the associated controller. Create an angular service to hold the value you need between the pages:

`https://docs.angularjs.org/guide/services

Then use the value on your third page.

Matthew Merryfull
  • 1,466
  • 18
  • 32
  • This way is also possible. I think using a mix of Services providing complex data and State-Parameters to retrieve specific data needed is the way to go. Example: Store data with some id in Service and pass the id via Stateparams to your state. – nabinca Sep 25 '15 at 09:55