Closed npw1982 closed 11 months ago
You can just set the attributes yourself:
{{-- Whatever Alpine logic you need… --}}
<div x-data="{ myAlpineVariable: [] }" x-init="fetchStuffWithAxios">
{{-- Just call `setAttribute` with whatever alpine directives you need… --}}
{{ Aire::select(...)
->setAttribute('x-model', 'myAlpineVariable') }}
</div>
Thanks for responding :) i'm not sure this exactly what I meant, I was after a way to bind the alpine variable to the bit that generates the option list itself? (I may be misunderstanding your answer though!) more like the options themselves...
https://alpinejs.dev/directives/model#dynamically-populated-select-options
Is your feature request related to a problem? Please describe. When implementing dependent select lists (where one filters another) using axios to fetch the filtered child list, It would be nice to be able to provide an Alpine variable as the source for an select list.
Describe the solution you'd like Provide an alpine variable name as the select list source.
Describe alternatives you've considered Can't think of any other ways to implement this using the fluent Aire builder?
Anyone else doing anything like this?