Discussion
Discussion copied to clipboard
Can't access `text` of `option` in `select`
I'm trying to access the text of a selected option by using Dynamic Select Options as described here: http://vuejs.org/guide/forms.html#Dynamic_Select_Options
I can retrieve the value but not the text.
<select v-model="newPayScale" options="payScaleOptions" number></select>
and:
payScaleOptions: [
{ text: 'Option 1', value: 1 },
{ text: 'Option 2', value: 2 }
]
What's the proper way to retrieve the selected text? Referencing {{ newPayScale.text }} doesn't work.
This was somehow overlooked when I designed the options usage!
For now you can use a computed property to loop through the options and find the text that matches the current newPayScale value.
Thanks!
Has this been included yet?