dimanche 23 décembre 2018

How to normalize data in meber.js

I have related data Attribute --> Values in meta section.

pushPayload works fine

this.store.pushPayload(res.products.get('meta.attributes'))

But I need push into model only new data, so I try to normalize:

model.set('attributes', this.store.normalize('attribute', res.products.get('meta.attributes')));

During normalize I got error:

string.js:63 Uncaught TypeError: Cannot read property 'replace' of undefined
    at Cache.func (string.js:63)
    at Cache.get (ember-metal.js:2611)
    at decamelize (string.js:100)
    at Cache.func (string.js:11)
    at Cache.get (ember-metal.js:2611)
    at Object.dasherize (string.js:104)
    at normalizeModelName (-private.js:560)
    at Class.modelNameFromPayloadKey (json-api.js:352)
    at Class._extractType (json-api.js:338)
    at Class.normalize (json-api.js:379)

So what is the error here? I don't want write loop on meta.attributes and use peekRecord




Aucun commentaire:

Enregistrer un commentaire