2.0 example for Value Binding with Select Options seems broken
See original GitHub issueI’m learning Vue by working through the 2.0 guide, so this is likely my mistake.
When I try to implement the Form Input Bindings - Value Bindings - Select Options example as below, I get vm.selected === undefined
whenever I select any option (also, the first option, 123, always appears “checked” in the dropdown).
I’m using Vue.js v2.0.0-rc.5
My code is here: https://github.com/jvanbrug/vue-guide-examples/tree/master/08_Form_Input_Bindings/02_Value_Bindings
The live demo of that code is here: https://jvanbrug.github.io/vue-guide-examples/08_Form_Input_Bindings/02_Value_Bindings/index.html
Thanks for Vue, Vuejs.org, and any help with this! 😃
index.html
<body>
<div class="content">
...
<div id="example-select" class="demo">
<select v-model="selected">
<option v-bind:value="{ number: 123 }">123</option>
<option v-bind:value="{ number: 456 }">456</option>
<option v-bind:value="{ number: 789 }">789</option>
</select>
<div>
Selected type: {{ typeof selected }}
</div>
<div>
Selected number: {{ typeof selected === 'object' ? selected.number : 'N/A' }}
</div>
</div>
...
</div>
<script src="../../vue.js"></script>
<script src="./main.js"></script>
</body>
main.js
...
var vm = new Vue({
el: '#example-select',
data: {
selected: undefined
}
})
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Value binding with select options seems broken #3673 - GitHub
I'm learning Vue by working through the 2.0 guide, and when I created vuejs/v2.vuejs.org#404 in the vuejs.org repo, @LinusBorg said the ...
Read more >Binding a select option using NgModel in Angular 14
i'm trying to bind select option values to my component's typescript page. If the selected option is Admin, the variable should hold the ......
Read more >Angular Material Mat Select Dynamic Data Binding ... - StackBlitz
Select with 2-way value binding.
Read more >ADFS SSO troubleshooting - Windows Server | Microsoft Learn
This article helps you resolve single sign-on (SSO) issues with Active Directory Federation Services (AD FS). Select one of the following ...
Read more >Object Binding Tips and Tricks - CODE Magazine
Selected Value. Binding source and property to which the user-selected value should be assigned. This should be a property of ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@LinusBorg It looks like it was resolved. Thanks!
Well, as far as I know, the functionality described there should work that way, but it doesn’t.
I may be wrong, but an issue on the Vue repo is a good start to investigate.