在backbone.js中,我想做:
initialize: =>
@collection.on("add", @appendModel(model)) # <- how to correctly write it?
render: =>
# do some render
@collection.each(@appendModel())
appendModel: (model) ->
# append model to $el
目前,我有@collection.on("add", @render)
,但这会重新绘制整个系列。我只想 fire appendModel()
,但我不确定在这种情况下如何在参数中传递模型。