mercredi 26 août 2015

Ember: all nested roots params and query params

I am actually trying to implement a 'back' functionnality on my project. The usecase is that there should be a 'back' button on some pages to get back. And it should be a little bit different from the 'back' browser button default behaviour. Here it is: a user is on a search page (let's call this page backable route) and she clicks on an item to see the item details page (let's call it backing route). Then she may do some actions on this page by modifying the query parameters of this backing route. And if she wants to get back to the search page (backable route), she clicks the 'back' button (not on browser). Actually this what I do:

  1. user is on the search page
  2. she clicks on an item
  3. within the action that do the transition to the backing route I get the current route (which is the backing route) name and its parameters and store it
  4. then the user does something on the item details page and clicks on the 'back' button
  5. within the 'back' action I get the backing route name and its parameters and do the transition to it

The problem with this approach is the nested routes. If a backing route has nested routes then the nested routes' params (model id and query parameters) are lost.




Aucun commentaire:

Enregistrer un commentaire