Open StErMi opened 4 years ago
If you statically want to set a query, I think configure might suit you better. Can you explain why you want to refine as soon as it's available?
Hi in this specific case is when a user lands directly on the search page with a predefined query like www.algolia.com/search?quert=cookbook
We have the "routing" feature for that: https://www.algolia.com/doc/guides/building-search-ui/going-further/routing-urls/angular/
@Haroenv what if my case is more complex? My search route is /site/search
and I've defined my algoliaConfig
into layout.component.ts
(where the search box is) bu results are displayed in search.component.ts
.
Is it possible to still do that?
Yes, that should not be an issue, as long as you have an ais-instant-search
Yes, that should not be an issue, as long as you have an ais-instant-search
what if I'm using a custom angular widget that uses connectSearchBox
?
I've tried to set up a more complex example (compared to the documentation) but it seems to not work for me. Could you provide some?
Can you show a non-working example please?
Can you show a non-working example please?
Hi @Haroenv you can replicate the problem directly from the CodeSandbox that you are referring in the route documentation.
You just need to update Algolia libraries to these versions (those versions are installed by default when you create a new algolia project)
"instantsearch.css": "^7.4.2",
"instantsearch.js": "^4.7.0",
"angular-instantsearch": "^3.0.0-beta.5",
"algoliasearch": "^3.35.1"
Could you please give it a try and fix it? Because the actual example, with the newest Algolia libraries, is not working at all.
InstantSearch.js needs to be version 3 for Angular InstantSearch version 3, sorry if those peer dependencies aren't clear
@Haroenv so the official documentation on algolia about angular-instasearch is wrong?
These are the dependencies suggested to install:
npm install algoliasearch@3 angular-instantsearch@beta instantsearch.js
npm install --save-dev @types/algoliasearch
Ah thanks for mentioning that, normally you should have gotten a peer dependency error, but the docs indeed wasn't correct. I've opened a PR to fix that
Hi all,
I'm creating a custom widget that extends connectSearchBox behavior. My component has a default query value and I would like to trigger a state.refine as soon as the method is available (It seems that state.refine is initialized asynchronously).
Could you please share an example to do that? it seems that the documentation is missing for this scenario.