Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MdSelect integer 0 as Value is not working #1203

Closed
jackovsky8 opened this issue Nov 22, 2017 · 0 comments
Closed

MdSelect integer 0 as Value is not working #1203

jackovsky8 opened this issue Nov 22, 2017 · 0 comments

Comments

@jackovsky8
Copy link

Steps to reproduce

I try to use MdSelect with an array of objects like:
types: [{id: 0,name:"Option 1"},{id: 1,name: "Option 2"}],

`<md-field>`
    `<label>Id</label>`
    `<md-select v-model="type_id">`
        `<md-option v-for="item in types" :value="item.id">{{ item.name }}</md-option>`
    `</md-select>`
`</md-field>`

What is actually happening?

Choosing Option 1 is not working correctly - no label is shown.

In the Vue Devtools it shows in the Element MdSelect:
MdSelect:Object
items:Object
1:"Option 2"
md-option-3eb70hnhr:"Option 1"
md-option-5ldo6g1t4:"Option 1"
md-option-8qwf8bb4e:"Option 1"
md-option-b2d52ef6:"Option 1"
md-option-fly0yb5x7:"Option 1"
md-option-jqu2sg9y5:"Option 1"

The value is saved correctly in the model 'type_id'

Reproduction Link

https://codepen.io/jackovsky888/pen/jaxWKG?editors=1111

marcosmoura pushed a commit that referenced this issue Nov 27, 2017
* fix(MdInput): Avoid InputEvent object from @input event

fix #1160

* fix(MdField): `$emit` missing `this`

* fix(MdSelect): declare all MdSelect properties in `data()` and make `MdSelect.modelValue` synced wit

* feat(MdField): make 'v-model'/'value' in MdFile, MdInput, MdSelect, MdTextarea optional

`MdSelect` could be switched between single and multiple

fix #1150

* feat(MdSelect): one way update with `value`

* fix(MdOption): let value avaiable to be `0`

fix #1203

* fix(MdField): set value default as null

* fix(MdField): Remove value default

#1196 (comment)

* style(MdSelect): brackets for if statement execute block

#1196 (comment)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants