i have 2 models:
// models\departament.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr('string'),
project: DS.belongsTo('project'),
});
// models\project.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr('string'),
departaments: DS.hasMany('departament',{inverse: 'project'})
});
and template:
// templates\new.hbs
<select class="form-control" onchange=>
<option class="form-control" value=""> - </option>
</select>
<option class="form-control" value=""></option>
this dont work (( I want that when I select project it will update data in departament select field
I use Json api, how i can use :
"relationships": {
"departaments": {
"data": [
{
"id": "1",
"type": "departament"
},
{
"id": "2",
"type": "departament"
},
{
"id": "3",
"type": "departament"
}
],
"links": {
"related": "/api/project/1/departaments",
"self": "/api/project/1/relationships/departaments"
}
}
}
sorry for my eng Может есть кто знает русский ?:slight_smile:
Aucun commentaire:
Enregistrer un commentaire