Backbone不在Rails中工作

时间:2014-10-13 19:46:13

标签: backbone.js

我已将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。

0 个答案:

没有答案