jeudi 28 janvier 2016

Data not loading in API but is in Cache - Ember

When trying to load embedded data, I have a problem in that when the model is already cached on my page, this embedded data will not load in the view. If, however, it it is reloaded from scratch and therefore read from the API, it does load. I can see that the data is being loaded into the model from the Ember inspector plugin, however. If anyone could tell me the issue here so that the data will load every time, this would be appreciated. Many thanks.

import DS from 'ember-data';
import WebApiSerializer from 'ember-web-api/serializers/web-api';

export default WebApiSerializer.extend(DS.EmbeddedRecordsMixin,{
    attrs: {
        subjects: { embedded: 'always' }
    }
});

Education Models

import DS from 'ember-data';

    export default DS.Model.extend({
        name: DS.attr('string'),
        graduationDate: DS.attr('string'),
        institutionLevel : DS.attr('string'),
        subjects: DS.hasMany('subject'),
        cv: DS.belongsTo('cv')
    });

Subject Model (Embedded to Education)

import DS from 'ember-data';

export default DS.Model.extend({
    name: DS.attr('string'), 
    grade: DS.attr('string'), 
    education: DS.belongsTo('education')
});




Aucun commentaire:

Enregistrer un commentaire