e-picsa / picsa-apps

Monorepo for building tools to support E-PICSA Apps
https://picsa.app
GNU General Public License v3.0
6 stars 2 forks source link

feat(resources): link search text to route navigation #227

Closed chrismclarke closed 7 months ago

chrismclarke commented 8 months ago

Is your feature request related to a problem? Please describe. Following the updates in #223, a new search page exists from where resources can be searched. Links to resource collections can be followed, however when navigating back the list of search results has reset.

Describe the solution you'd like Search input text to be stored as a url query parameter, and used to set the default search text. By doing this it should also make it possible to navigate to the search page with a pre-built search term ready, e.g.

/resources/search?searchText=crops

Describe alternatives you've considered Storing local variables or navigation state data, however this would not work if a user is trying to link directly to a pre-filled search page

Additional context Examples or accessing queryParams can be found at: https://www.digitalocean.com/community/tutorials/angular-query-parameters

Another challenge will be to update the current route to capture the queryParams as the user types in the box. Angular does support same-route navigation, some examples on stackOverflow: https://stackoverflow.com/questions/43698032/angular-how-to-update-queryparams-without-changing-route