Skip to content
Snippets Groups Projects
Commit 8c7787e4 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

Merge branch 'fix/fill-querystring-url' into 'dev'

fix: fill the query input with url param and reset url param on query changes

See merge request web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client!139
parents e403d3b9 b123f00c
No related branches found
No related tags found
3 merge requests!178release V1.10.0,!154Dev,!139fix: fill the query input with url param and reset url param on query changes
...@@ -51,7 +51,9 @@ export class StructureListSearchComponent implements OnInit { ...@@ -51,7 +51,9 @@ export class StructureListSearchComponent implements OnInit {
private router: Router private router: Router
) { ) {
this.searchForm = this.fb.group({ this.searchForm = this.fb.group({
searchTerm: '', searchTerm: this.activatedRoute.snapshot.queryParamMap.get('search')
? this.activatedRoute.snapshot.queryParamMap.get('search')
: '',
}); });
} }
ngOnInit(): void { ngOnInit(): void {
...@@ -91,6 +93,10 @@ export class StructureListSearchComponent implements OnInit { ...@@ -91,6 +93,10 @@ export class StructureListSearchComponent implements OnInit {
}, },
queryParamsHandling: 'merge', queryParamsHandling: 'merge',
}); });
} else if (!term) {
this.router.navigate(['/acteurs'], {
relativeTo: this.route,
});
} }
const filters: Filter[] = []; const filters: Filter[] = [];
if (term) { if (term) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment