Dynamically add js object to model array in 1.13

后端 未结 3 1885
无人及你
无人及你 2021-02-18 21:11

I have the following code:

var msg = this.store.createRecord({text:\'first title\', createdAt: \"2015-06-22T20:06:06+03:00\" })

this.get(\'model.content\').push         


        
3条回答
  •  礼貌的吻别
    2021-02-18 21:34

    I would make all return models to array then, add array to this array

    setPeople:function(){
        this.set('people',this.get('content').toArray())
    }.observes('content')
    

    then, find more person models, to array

    getMoreUsers(){
          var self = this;
                this.set('offset', this.get('offset')+1);
                self.store.findAll('person').then(function(people){
                 self.get('people').pushObjects(people.toArray());
                });
    

提交回复
热议问题