feat: search url query param handling

This commit is contained in:
Thea Schöbl
2022-11-01 12:58:29 +00:00
committed by Rainer Killinger
parent 38f0a30076
commit f349bd7233
7 changed files with 23 additions and 19 deletions

View File

@@ -277,6 +277,11 @@ export class SearchPageComponent implements OnInit, OnDestroy {
* Search event of search bar
*/
searchStringChanged(queryValue: string) {
this.router.navigate([], {
relativeTo: this.route,
queryParams: {query: queryValue},
queryParamsHandling: 'merge',
});
this.queryTextChanged.next(queryValue);
}
@@ -366,7 +371,7 @@ export class SearchPageComponent implements OnInit, OnDestroy {
* Initialize
*/
async ionViewWillEnter() {
const term = this.route.snapshot.paramMap.get('term') || undefined;
const term = this.route.snapshot.queryParamMap.get('query') || undefined;
if (term) {
this.queryText = term;
this.searchStringChanged(term);