I am new to Ember and I am using a JSONSerializer to change my JSON. This is my code
import JSONSerializer from 'ember-data/serializers/json';
export default JSONSerializer.extend({
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
var listOptions = payload.clients;
for(i = 0; i < listOptions.length; i++) {
//we do some operations and we end up with foo
}
newData = foo;
for(i = 0; i < payload.clients.length; i++) {
payload.clients[i].NAME = newData[i].text;
payload.clients[i].id = newData[i].value;
}
return this._super(...arguments);
}
And in the return I get this error:
ember.debug.js:27431 Error while processing route: index payload.map is not a function TypeError: payload.map is not a function
My version of Ember is 2.4.3 .
So gurus of Ember what is going wrong with my code?, my return is exactly like the ones from the documentation and I am getting a bit desperate. http://ift.tt/1VRZQKi .
Thank you very much.
Aucun commentaire:
Enregistrer un commentaire