When using "Dynamically populated Select Options" x-model is empty on first render #4546
Replies: 3 comments
-
This issue has been converted to a discussion as we are now using discussions to track bugs and ideas. |
Beta Was this translation helpful? Give feedback.
-
Why would it? You never set anything to the model. the select does not emit a change event when it gets new options added. Could you not set the x-model color to red ahead of time? |
Beta Was this translation helpful? Give feedback.
-
I know I could do that, currently I am using But if you ask me, it would be more elegant, if alpine does this under the hood, upon init. |
Beta Was this translation helpful? Give feedback.
-
When using "Dynamically populated Select Options"
x-model
is empty on first render.Expected behaviour: The first value in the list (
Red
) should be loaded intox-model
.Dynamically populated Select Options
https://alpinejs.dev/directives/model#dynamically-populated-select-options
Also check: #1872
Beta Was this translation helpful? Give feedback.
All reactions