无法呈现骨干视图

时间:2013-07-10 18:23:01

标签: backbone.js backbone-views

我有继承的骨干视图:

class App.Views.User.Base extends Backbone.View
  el: '#main'

  initialize: ->

  events:
    'click .save': 'save'

  render: ->
    @$el.html @template user: @model
    @    


class App.Views.User.Registration extends App.Views.User.Base
  template: JST['template/users/registration']

  save: ->
    if not @model.expired()
      @model.save {},
        error: (model, response) ->
          console.log response.responseText

当我试图渲染时:

(new FancySurvey.Views.User.Registration(model: model)).render()

我收到了错误:

Property 'template' of object #<Registration> is not a function

可能有什么问题?感谢

1 个答案:

答案 0 :(得分:0)

问题在于模板文件的路径错误,在我的情况下它应该是

class App.Views.User.Registration extends App.Views.User.Base
  template: JST['users/registration']
  ...