I have the following:
Two models belonging to each other
export default DS.Model.extend({
cv: DS.belongsTo('cv'),
export default DS.Model.extend({
title: DS.attr('string'),
personalDetail: DS.belongsTo('personal-detail'),
and a route with the following
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.modelFor('build').get('personalDetail');
},
actions: {
saveDetails(mod)
{
const details = this.modelFor('build').get('personalDetail');
}
}
});
In the Hbs
<div class="row">
<div class="col-xs-2 col-xs-offset-9">
<button {{action "saveDetails" model on="mouseUp"}} class="btn1 btn--white-blue big right">
NEXT
<span>
<svg role="img" fill="currentColor">
<use xlink:href="icons/icons.svg#arrow-down"></use>
</svg>
</span>
</button>
</div>
</div>
So what happens here is that I have a root object called cv and has a belongs to relationship to persontalDetail
when I call the info route it gets the model for the build route(which is a parent route) which is the cv object, from there it gets ther personalDetail model and passes it on to the page.
When I click on the savedetails I'm expecting the model to be returned to the method but for some reason a null is being passed.
I have a similar setup on other pages for objects with a has many relationship but I cant get it to work with the above.
Any ideas on what I am doing wrong?
Aucun commentaire:
Enregistrer un commentaire