I am using Ruting URLs in angular instasearch v3 and create a general search engine with which I access the list of products on my website modifying the url with the corresponding query, example: if in the general search engine I put ‘cars’ and press enter I get the page /products?query = ‘cars’ and the uiState updates fine. The problem is when I am already on the page /products?query = ‘cars’ and I do another search in the general search engine, suppose bicycles, the url changes to /products?query = ‘bicycles’ but the ais-search-box does not it changes its value and neither do the results.
It is true that the page does not reload because angular does not reload since it is the same url / products, and therefore the parseURL function does not execute, but if in the function ‘routeToState (routeState)’, I put a console.log ( routeState) I see the routeState.query change, I don’t understand why this is not reflected in uiState.
I hope I was clear.
Hi @giannilupi9, the issue seems clear, but I can not reproduce this with our demo sandbox, can you edit it to show your issue? https://codesandbox.io/s/github/algolia/angular-instantsearch/tree/v3/examples/e-commerce
Hi @haroen, thanks for answering! The code in that link has an error and does not load the view
There indeed seems to be a problem with this on codesandbox, but it runs fine on my machine, you can clone and run this example on your machine, then post it on GitHub somewhere: https://github.com/algolia/angular-instantsearch/blob/develop/examples/e-commerce
I managed to run the code on my computer but I still see the same problem I have in my implementation.
I enclose an image of the problem so that it is better understood.
in the image, start typing ‘he’ in search-box and then fill in the browser bar ‘llo’ but don’t hit enter and then the page doesn’t update with new
I leave a sandbox with the code recreated using navigateByUrl () in the search button that appears in the last image
Sorry, could you show an example of a website which implements this? I don’t think it’s possible to listen to changes in the browser URL bar, for safety reasons.
I have edited your example to be more compliant here by the way: https://codesandbox.io/s/great-shadow-5jufx?file=/src/app/search/search.component.html
Could you explain more clearly what isn’t behaving like expected? I don’t see issues with it
If you are talking about the searchbox not keeping the value, I’d advice you to have a look at https://www.algolia.com/doc/guides/building-search-ui/widgets/customize-an-existing-widget/angular/#extending-widget-example (the guide is for v3, but most also applies for v2). You essentially use the refine function of the connectSearchBox, and its value, instead of directly interfacing with the URL.