我在导轨3骨干视图,其中初始化具有动态地与这样将内容添加到使用Rails
initialize:() ->
$('body').append('<div class="new"></div>')
在div的内容的类创建一个div的线在骨干动态创建的元素在一个生态文件“new.jst.eco”中。当前代码:
class TestApp.Views.NewDivView extends Backbone.View
el: '.new' # newly created in the initialize method.
template: JST['new']
render: ->
$(@el).html(@template())
this
initiaize:() ->
$('body').append('<div class="new"></div>')
如何将模板的内容添加到同一视图中新创建的div中?