I am using one rest framework that will reproduce following result:
- {
- count: 10
- results: [
- { id: 1 },
- { id: 2 },
- { id: 3 }
- ]
- }
I need to adapt this custom server response to findAll method. I have tried following code but didn't work.
- var Asset = can.Model.extend(
- /* @static */
- {
- findAll : "GET /feed/",
- },
- /* @Prototype */
- { }
- );
- Asset.List = can.Model.extend({
- },
- {
- findAll: function(params, success, error) {
- var self = this;
- // Uncaught TypeError: Object #<Constructor> has no method 'model'
- this.model().findAll(params, function(items) {
- self.push(items.results);
- if (success) {
- success(self);
- }
- }, error);
- }
- })
My usage code
- new Asset.List().findAll({});
In the findAll method, this.model raises error, anyone knows about that? Thanks!