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:
- user is on the search page
- she clicks on an item
- 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
- then the user does something on the item details page and clicks on the 'back' button
- 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