找不到Javascript类实例
我正在使用MonocleMVC。我正在使用以下代码创建一个新的类实例:找不到Javascript类实例,javascript,coffeescript,monocle,Javascript,Coffeescript,Monocle,我正在使用MonocleMVC。我正在使用以下代码创建一个新的类实例: __Controller.Lists = new ListCtrl('article#lists') __Controller.Sessions = new SessionCtrl('section#splash') (内部指的是单片眼镜) ListCtrl中的代码正常工作,但我无法访问变量\uu Controller.Lists。它说它是未定义的 但是,\u controller.Sessions在以下代码中定义: _
__Controller.Lists = new ListCtrl('article#lists')
__Controller.Sessions = new SessionCtrl('section#splash')
(内部指的是单片眼镜
)
ListCtrl
中的代码正常工作,但我无法访问变量\uu Controller.Lists
。它说它是未定义的
但是,\u controller.Sessions
在以下代码中定义:
__Controller.Lists = new ListCtrl('article#lists')
__Controller.Sessions = new SessionCtrl('section#splash')
更新
这段代码似乎阻止了类的定义:
class ListCtrl extends Monocle.Controller
# THIS CONSTRUCTOR
constructor: ->
super
__Model.List.bind "create", @bindCreate
__Model.List.bind "change", @bindChange
__Model.List.bind "error", @bindError
__Model.List.bind "destroy", @bindDestroy
@bindChange()
更新2
Turnet out@bindChange()
是原因。知道原因吗?代码中的其他地方可能有错误。你确定一切都编译正确吗?控制台中是否没有错误?谢谢。我找到了问题的根源。我更新我的答案