question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.0 example for Value Binding with Select Options seems broken

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
JanCVanBcommented, Sep 14, 2016

@LinusBorg It looks like it was resolved. Thanks!

1reaction
LinusBorgcommented, Sep 14, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found