Uncaught TypeError: undefined is not a function rails3/backbone/js

后端 未结 5 1445
臣服心动
臣服心动 2021-02-14 08:38

I just started delving into javascript to make project more responsive and I am working through a backbone.js example.

I\'ve replicated http://www.jamesyu.org/2011/01/27

5条回答
  •  轮回少年
    2021-02-14 09:42

    Ran into the same problem, and then I figured out that I haven't included underscore.js anywhere. So I wrote a simple backbone.js file:

    /*
     *= require backbone/underscore-min.js
     *= require backbone/backbone-min.js
     */
    

    and stored it under vendor/assets/javascripts along with the Backbone and Underscore files:

    vendor/assets/javascripts/
    ├── backbone
    │   ├── backbone-min.js
    │   └── underscore-min.js
    └── backbone.js
    

    My application.js.coffee looks something like this one now:

    #= require backbone
    #= require query
    

提交回复
热议问题