不插入對象我有以下ArrayController:Ember.js PushObject在ArrayController
Lead.Controllers.Leads = Ember.ArrayController.extend
init: ->
content: Ember.A()
@view = Ember.View.create
controller: @
templateName: 'app/templates/leads/list'
@view.appendTo $('#leads')
addLead: (data) ->
lead = Lead.Lead.create()
lead.setProperties JSON.parse data
console.log lead.get 'company'
debugger
@pushObject lead
console.log @get('length')
問題是後我請推目的,長度仍然0
。我真的不明白我做錯了什麼。
任何人都可以看到我做錯了什麼?我唯一能想到的就是通過Ember.A()
將內容設置爲空數組。
我不知道它可能是什麼。
謝謝,我沒有從init調用_super()。那是我錯過的一點。這是需要的可惜。 – dagda1 2012-03-09 20:56:03