Hi i am getting following json from my rest API.
{
"content":
[{
"id" : 56789,
"name" : "sample book",
"status": "available",
},{
"id" : 56789,
"name" : "sample book",
"status": "available",
}],
"last": true,
"totalElements": 5,
"totalPages": 2,
"size": 3,
"number": 1,
"sort": null,
"first": false,
"numberOfElements": 2
}
Ember Book Model
export default DS.Model.extend({
id: DS.attr(),
name: DS.attr(),
status: DS.attr()
});
Ember Route
import Ember from 'ember';
import RouteMixin from 'ember-cli-pagination/remote/route-mixin';
export default Ember.Route.extend(RouteMixin, {
model: function(params) {
params.paramMapping = {
perPage: "size"};
return this.findPaged('book',params);
}
});
In the Firefox network tab i can able to see the response but in browser console i am getting the following message,
Error while processing route: book.index data is undefined _pushInternalModel
In Chrome getting following exception:
ember.debug.js:30610 Error while processing route: books.index Cannot read property 'type' of undefined TypeError: Cannot read property 'type' of undefined
I am using following versions of ember : "ember-cli": "2.5.0", "ember-cli-pagination": "2.2.2"
I am new to ember.Could anyone please help me to resolve this issue?I think i should serialize the response using "normalizeResponse" but i don't know how to do it.
Aucun commentaire:
Enregistrer un commentaire