mercredi 18 mai 2016

Ember: get multiple select values from HTML select tag

I have a multiple select and a submit button for when the selection is done.

I use the image-picker jQuery plugin that needs the "data-img-src" property added to each , so I guess I cannot use the Ember.Select view, I made an Ember component instead.

#templates/components/image-picker.hbs

<select multiple="multiple" class="image-picker">
  
  <option data-img-src="" value=""></option>
  
</select>

used in a template: (not sure whether the form tag is useful as I can put the action on the button?)

#templates/new.hbs
<form >
  
  
</form>

But then I don't know how to read the selected values in my controller.

#controllers/new.js
import Ember from 'ember';

export default Ember.Controller.extend({
  actions: {
    createTeam: function() {
      alert("?");
    }
  }
});




Aucun commentaire:

Enregistrer un commentaire