0

A question about filters and routes - if the application is in a state after the user has picked a load of filters, is it possible to share the url so another user receives the same state.

for example on my ng-repeat I have something htat looks like this :-

<ul 
ng-repeat="event in filteredItems  = ( events | filter:{ festivalApplicationId: search.festivalApplicationId, interestId: search.interestId, eventTypeId: search.eventTypeId, expId: search.expId})">

So I guess A) I need to update the url everytime a filter is changed and B) pull this logic off the page and in to a controller?

Any suggestions or help would be much appreciated.

Iamsamstimpson
  • 1,359
  • 2
  • 17
  • 32
  • 1
    Yes, you will need to put everything in a controller, use $routeParams, $location.search() and a function to put the serialized params in the url. This might help http://stackoverflow.com/questions/20015805/store-view-state-in-url-using-angularjs – alou Oct 13 '14 at 12:33
  • Maybe a naive assumption on my part, but looking at your code wouldn't each 'event' in filtered items resolve to a very specific url with not much need to share state? Assuming clicking the event results in navigation to a new page. If clicking an event means navigating to a nested view (again using something like angular-ui router) then why would you need the complete state transferred to the sub view? – mccainz Oct 13 '14 at 12:35

0 Answers0