Dynamically add js object to model array in 1.13

后端 未结 3 1887
无人及你
无人及你 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:43

    One possible solution without resorting to private API is to use toArray() (github issue):

    var array = this.get('messages').toArray()
    array.addObjects(this.get('messages'))
    array.addObject(msg)
    this.set('messages', array)
    

提交回复
热议问题