ManuelDeLeon / viewmodel

MVVM for Meteor
https://viewmodel.org
MIT License
205 stars 23 forks source link

optionsText via function #275

Closed Mattze96 closed 8 years ago

Mattze96 commented 8 years ago

html:

<select class="form-control multiselect" size="4" {{b "options: intern_events, 
optionsValue: _id, optionsText: display_event, value: selected"}}>
</select>

js:

Template.test.viewmodel({
  selected: null,
  intern_events: function() {
    return Intern_Event.find();
  },
  display_event: function(item) {
    return item.title + ' ' + item.date;
  }
});

optionsText takes currently only an object-key for the options-array. Is it possible to provide a function like above?

ManuelDeLeon commented 8 years ago

Great idea. Update to v6.1.0