Closed NullVoxPopuli closed 8 years ago
I decided to go with ember cli x select, and came up with this:
= x-select value=model.membershipOption
option value='' Select an option
each membershipOptions as |option|
= x-option value=option
= option.name
Me too.
I'm struggling with make Ember2 select work in emblem too. I'm trying to following this pattern:
<select onchange={{action (mut vehicle) value="target.value"}}>
{{#each vehicles as |vehicleChoice|}}
<option value={{vehicleChoice}} selected={{eq vehicle vehicleChoice}}>{{vehicleChoice}}</option>
{{/each}}
</select>
source: http://balinterdi.com/2015/08/29/how-to-do-a-select-dropdown-in-ember-20.html
... but I can't make it translate to emblem though the change
event or through {action}
.
Would the following work?
select{ action (mut vehicle) value='target.value' on='change' }
= each vehicles as |vehicleChoice|
option value=vehicleChoice selected={ eq vehicle vehicleChoice }
= vehicleChoice
This translates to
<select {{action (mut vehicle) value="target.value" on='change' }}>
{{#each vehicles as |vehicleChoice|}}
<option value={{vehicleChoice}} selected={{eq vehicle vehicleChoice}}>
{{vehicleChoice}}
</option>
{{/each}}
</select>
Emblem really needs better support of action helpers on HTML elements. It's been something I've been meaning to poke at for awhile.
I tried some variations of that yesterday but I was seeing errors if I didn't put (mut vehicle)
in quotes. Which of course would do me no good.
Fixed by #270
so far I have this:
selectOption is properly triggered, but the parameter is empty.
I'm wanting to set the membershipOption relationship on the model.