Again Ember is driving me mad. I have what I think is a fairly normal JSON response:
"data": {
.....
"user": {
"name": "John",
"surname": "Doe"
}
....
}
And then a model "app/models/data.js":
import DS from 'ember-data';
export default DS.Model.extend({
....
user: DS.belongsTo("user"),
....
});
with the user model "app/models/user.js":
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr(),
surname: DS.attr()
});
Yet, the page refuses to load - let alone work. If I remove the "user" line from the "data" model, it works (but then obviously doesn't have the user info).
What is going wrong? Looking through all the other StackOverflow questions, I'm tempted to believe its because its looking for an ID in the "users" model - but that doesn't exist. The JSON response I get is exactly as above - ie, its not loaded and populated into that response. It comes as is.
I'm using: Ember v 1.13.2 Ember-Data v 1.13.4
Aucun commentaire:
Enregistrer un commentaire