【问题标题】:Backbone.Marionette 1.2 has no method 'bindTo'Backbone.Marionette 1.2 没有方法 'bindTo'
【发布时间】:2013-11-12 14:00:25
【问题描述】:
userView = Marionette.View.extend
  tagName: "h1"
  initialize:->
    @bindTo @model, "change:name", @render, this
  render: ->
    @$el.html  @model.get('name')

我收到此错误:

Uncaught TypeError: Object [object Object] has no method 'bindTo'

我使用了主干 1.1.0 那么我缺少什么?

【问题讨论】:

    标签: javascript backbone.js coffeescript marionette


    【解决方案1】:

    使用:

    this.listenTo(this.model, "change:name", this.rednder)
    

    如果你想使用函数 bindTo,你必须在 Backbone.EventBinder 对象的实例上使用它。示例here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-31
      • 2012-07-11
      • 1970-01-01
      • 2011-09-14
      • 1970-01-01
      • 1970-01-01
      • 2015-06-08
      • 1970-01-01
      相关资源
      最近更新 更多