我已将gem 'backbone-on-rails'
添加到我的项目中,执行rails g backbone:install
命令
我把它添加到我的骨干>意见>索引文件(它被渲染)但我没有看到" Hello world"在我主页上的#container中。
class Movieseat.Views.MovieseatsIndex extends Backbone.View
template: JST['movieseats/index']
# el - stands for element. Every view has a element associate in with HTML content will be rendered.
el: "#container"
# It's the first function called when this view it's instantiated.
initialize: ->
@render()
# $el - it's a cached jQuery object (el), in which you can use jQuery functions to push content. Like the Hello World in this case.
render: ->
@$el.html "Hello World"
我认为这会渲染html" Hello world"进入#container div。