我有一个主干路由器
@collection = new Backbonedemo.Collections.Posts()
@flashes = new Backbone.Collection.Flashes()
在其initialize
方法中。
在路由器的new
方法中,有这样的:
new: ->
view = new Backbonedemo.Views.PostsNew(collection: @collection, flashes: @flashes)
$('#posts_container').html(view.render().el)
@collection
变量传入就好了,但是在render()
,console.log @flashes
返回undefined
。
那么,我错过了什么?