While I working with my project in ember-cli I use select-picker to make the ember-select have bootstrap view. The code is like this:
hbs operation:
{{#each ophotel in model.ophotels}}
{{select-picker content=hotels
selection=ophotel.hotel
optionValuePath="content.id"
optionLabelPath="content.hotelname"
}}
{{/each}}
model operation:
export default DS.Model.extend({
ophotels: DS.hasMany('ophotel', {async: true})
});
model ophotel:
export default DS.Model.extend({
hotel: DS.belongsTo('hotel', {async: true})
});
model hotel:
export default DS.Model.extend({
hotelname: DS.attr('string'),
ophotels: DS.hasMany('ophotel', {async: true})
});
controller operation:
hotels: function(){
return this.store.find('hotel');
}.property(),
This code set the ophotel.hotel correctly but whatever I choose my select-picker always show "Nothing Selected"
Aucun commentaire:
Enregistrer un commentaire