mercredi 30 novembre 2016

ember-ted-select and ember objects in ember 2.9.1

Im currently using ember-ted-select (http://ift.tt/2g7nz6I) everything is going fine except ember keeps on returning an ember object and not a value onchange.

This is how I set it up to get it to display the label but I have a feeling its wrong:

Controller:

export default Ember.Controller.extend({
  categories:[{
    label: "Web",
    value: "web"
  }, {
    label: "iOS",
    value: "ios"
  }, {
    label: "Android",
    value: "android"
  }, {
    label: "Other",
    value: "other"
  }],
  actions: {
   update(newOption) {
     var opt = JSON.stringify(newOption);
     var selected = JSON.parse(opt);
     this.set('selected', selected.label);
   },
  }
});

HBS:



I also cannot get the selected init with the selected item. Any suggestions would be much appreciated.




Aucun commentaire:

Enregistrer un commentaire