-
Notifications
You must be signed in to change notification settings - Fork 338
Closed
Description
Is your feature request related to a problem? Please describe π
It does not work in Angular 14+
Describe the solution you'd like π€
Please make it work in Angular 14+
Describe alternatives you've considered β¨
I tried using just the Autocomplete, but when I click on an item I want to go to the item URL without reloading.
Now it refreshes the page which is not what I want in a SPA.
autocomplete({
container: '#autocomplete',
placeholder: 'Search for products',
debug: true,
getSources({ query }) {
return [
{
sourceId: 'courses',
getItems() {
return getAlgoliaResults({
searchClient,
queries: [
{
indexName: 'vetfysio courses',
query,
params: {
hitsPerPage: 5,
attributesToSnippet: ['text:10'],
snippetEllipsisText: 'β¦',
},
},
],
});
},
templates: {
item({ item, components, html }) {
return html`<div class="aa-ItemWrapper">
<div routerLink="${item['url']}" class="aa-ItemContent">
<div class="aa-ItemContentBody">
<div class="aa-ItemContentTitle">
${components.Highlight({
hit: item,
attribute: 'title',
})}
</div>
<div class="aa-ItemContentDescription">
${components.Snippet({
hit: item,
attribute: 'text',
})}
</div>
</div>
</div>
</div>`;
},
},
onSelect({ itemUrl }) {
console.log('itemurl', itemUrl);
},
getItemUrl({ item }) {
return item['url'] as string;
},
noResults() {
return 'No matching items.';
},
// ...
},
];
},
navigator: {
navigate({ itemUrl }) {
console.log('itemurl navigate', itemUrl);
window.location.assign(itemUrl);
// Here I should be able to use the Angular routing
},
},
// ...
});```
Metadata
Metadata
Assignees
Labels
No labels