()
| 20 | protected readonly searchResults = signal<SearchResultItem[]>([]); |
| 21 | |
| 22 | constructor() { |
| 23 | const activatedRoute = inject(ActivatedRoute); |
| 24 | const searchTerms = this.extractSearchTerm(activatedRoute.snapshot.url); |
| 25 | if (searchTerms) { |
| 26 | // We're using the one-shot query request to not interfere with the main search signal |
| 27 | this.search.searchWithQuery(searchTerms).then((results) => { |
| 28 | this.searchResults.set(results ?? []); |
| 29 | }); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | private extractSearchTerm(url: UrlSegment[]): string { |
| 34 | return url.join(' ').replace(/[-_/]/g, ' '); |
nothing calls this directly
no test coverage detected