Can someone help with example of related/nested select on ember 2.2? I create component app/components/link-pin-device.js
export default Ember.Component.extend({
selectedPin: null,
actions: {
selectPin(pin, wdevice) {
console.log(pin);
console.log(wdevice);
}
}
});
app/templates/components/link-pin-device.hbs
<select value="target.value" onchange={{action "selectPin" "target.value"}}>>
<option value="">Select...</option>
{{#each dcPinConfigs as |pinconf|}}
<option value={{pinconf.id}} selected={{eq selectedPinId pinconf.id}}>{{pinconf.id}}</option>
{{/each}}
</select>
{{yield}}
app/routes/web-device-module.js
export default Ember.Route.extend({
model() {
var self = this;
return Ember.RSVP.hash({
webDeviceModules: self.store.findAll('webdevicemodule'),
dcPinConfigs: self.store.findAll('dcPinConfig').then(function(d){
let dPin = self.store.peekRecord('dcPinConfig', 2);
let wMods = self.store.createRecord('webdevicemodule', {
dcPinLink: dPin,
name: "sda"
});
comment.save();
return d;
})
});
},
});
How i can change model webdevicemodule.dcPinLink then change value in select?
Aucun commentaire:
Enregistrer un commentaire