2013-07-10 107 views
0

我有骨气观点与继承:无法呈现骨干视图

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 

什么可能是问题?由于

+0

什么是'@ template'当'render'被调用? –

+0

@ muistooshort,它只是未定义 – megas

+1

而'JST ['template/users/registration']'是模板函数吗? –

回答

0

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

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