This.get ("model) .addObjects (records); throw exception" Uncaught TypeError: internalModel.getRecord is not a function "

Friends I need help, after upgrading to Ember 2.X, my endless scroll stops working. When I reach the end of the page, I request storage to get new entries:

 load_more: function(){
 var self = this;
  this.get("store").query("actor",{pg: 1}}).then(function(records) {

    self.get('model').addObjects(records); // this throw excepton 

  }
}

This worked fine, but now self.get('model').addObjects(records);throw exception "Uncaught TypeError: internalModel.getRecord is not a function" in record-array.js at line 86 "return internalModel && internalModel.getRecord()".

I tried to use self.get('model').pushObjects(records);, but it also gave the same error, please help

+4
source share
2 answers

We had the same problem .. try to do

self.get('model').toArray().pushObjects(records)
0
source

, . Ember get, promises:

load_more: function(){
  Ember.get(this, "store").query("actor",{ pg: 1 }}).then((records) => {
    Ember.get(this, 'model').addObjects(records);
  }
}

Ember 2.x babel, , => ( var self = this, ).

0

Source: https://habr.com/ru/post/1613009/


All Articles