Open Radiergummi opened 2 years ago
@TarekRaafat What do you think about this issue? If this is something we want for the project I would gladly provide a PR for that. I definitely see the use case and I also had a case like this already where this feature would have been useful.
+1
I tried the alternative @Radiergummi (thanks for that!) proposed, but could not get it to work.
Uncaught (in promise) TypeError: element is undefined
in line
src: (query, element) => fetch( element.dataset.suggestionsEndpoint )
I tried the alternative @Radiergummi (thanks for that!) proposed, but could not get it to work.
Uncaught (in promise) TypeError: element is undefined
Sorry, that was copy pasted sloppily! If you remove the second parameter element
from the callback, it will use the instance from the parent scope, and work.
Is your feature request related to a problem? Please describe. I'm creating multiple autocomplete elements on the page dynamically. They receive suggestions from a JSON endpoint which is resolved at template rendering time. To pass the proper endpoint to the autocomplete input, I would like to do the following:
In the next step, I would configure AutoComplete:
Alas, there's no way to get access to the data property.
Thoroughly Describe the solution you'd like It would be great if the current element were passed to the query callback as the second parameter:
Please provide a few use cases for this feature
Please Describe alternatives you've considered Obviously, binding every element by itself:
This works, but has the drawback of creating several instances instead of a single one.
Additional context