vendredi 27 novembre 2015

How to use ember select for static dropdown?

This has to be easy, but I'm failing.

I have this in a template:

<select {{action 'setType' this value="target.value"}}> <!-- I've tried various things for the value -->
  <option value="0">Choice 1</option>
  <option value="1">Choice 2</option>
</select>

I have this in a controller:

setType: function(mymodel, type) {
  mymodel.set('type', type);
  mymodel.save();
}

The action is firing, the model is available, but none of my guesses are sending the value of the select to the controller action.

I'm using Ember 1.13.7




Aucun commentaire:

Enregistrer un commentaire