Back button & keeping search results


#1

I’m using a seperate state and inline script to handle entering search criteria and subsequent results. All good so far.

The problem is that when I view the detail of one search results item and then hit back button - the results are lost completely and I have to re-enter search criteria and execute.

I realise this might be a ui-router topic but if anyone can help them that’d be great. I’m using bind-once currently but used pure ng before and even if I loaded the list manually with .html () whether it would make any difference.
Tom


#2

I’m on a pretty big deadline so if someone can reply (as this must be a common thing for people to come up against) I’d be very grateful.
Tom


#3

I’m not 100% sure if this will work, as I haven’t implemented it. In theory though, it should.

https://groups.google.com/forum/#!topic/angular/P6e9j8elKy4

Basically you take what ever it is you search for and store it in a factory then when you go back, call that factory.


#4

You can use the $rootScope to store the data (not recommended) or use a factory method to store that info, also you can use the value method of a module (easier).


#5

That’s great.
Thanks guys