Should x-model
with select
have the ability to decide if it should use .text
or .value
#2790
byjpr
started this conversation in
3. Feature Ideas
Replies: 1 comment 9 replies
-
I think the code you attached is only relevant for multi-select. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm wondering if I should write a PR to create a modifier that would allow the selection of either the value of the selected option or text.
Currently, the code will check for value, and if no value, it will take the text.
alpine/packages/alpinejs/src/directives/x-model.js
Lines 102 to 104 in 5cb4046
Current behaviour
If you have the following code:
The text inside
<span x-text="select"></span>
would berole1
.However,
The text inside
<span x-text="select"></span>
would beAdmin
.What would be introduced?
Another modifier that would set preference for
text
. E.G:x-model.text="select"
Beta Was this translation helpful? Give feedback.
All reactions