Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember Select to Update Model onChange

Tags:

ember.js

I have an Ember HBS template form with input and select fields. Input fields use a 'value' argument set to model.someField. When a user changes the input value, the model also gets changed and then shows there are changedAttributes staged.

I want to do this exact same thing with a select, but when I change the select value, the model.someField isnt getting updated automatically. What's the right way to do this?

I'm using Ember 2.9.

like image 708
user6041966 Avatar asked Feb 18 '26 18:02

user6041966


1 Answers

Credit to kumkanillam for this answer.

Adding onchange={{action (mut value) value="target.value"}} to the select fixed the auto update on the model.

like image 173
user6041966 Avatar answered Feb 21 '26 13:02

user6041966



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!