Keep search history (using JSON API)?
I have a search page, using a Json API. If the user runs many searches, I
want that when they press back the previous searches are still there. Like
using Google for example.
The search functionality is in a partial. This is the relevant part from
routeProvider:
$routeProvider. when('/', {templateUrl: '/partials/search.html',
reloadOnSearch: false}) ...
I had to add reloadOnSearch:false because of this.
So, well, now when I press back, the url in the navigation bar is updated
but the page is not updated.
Anyways, reloadOnSearch:true - given the case that I get that working -
would run the search again. I inspected the web traffic from Google and
they are not running the search again when I press back.
So... what do I have to do to keep these results in the navigation history?
I also found this thread about storing model data using a service. I think
this could be usable but I have no idea if it's a correct approach. Search
history sounds like something that should be built in. Maybe my code is
incorrect and it's not working because of that.
Thanks in advance.
No comments:
Post a Comment