Cannot call 'start' of undefined when starting backbone.js history.

后端 未结 8 1142
感情败类
感情败类 2020-12-15 16:30

I get Cannot call \'start\' of undefined when calling...

    Backbone.history.start()

When running some checks Backbone return

8条回答
  •  执笔经年
    2020-12-15 17:32

    Do you have any routes on the controller? Backbone only creates the history once at least one route is specified.

    More:

    TypeError: Cannot call method 'start' of undefined**

    Hmm, for some reason Backbone.history is undefined, and so there is no start method on it. It turns out that Backbone.js creates an instance of Backbone.History (upper case ‘H’) called Backbone.history (lower case ‘h’) once a controller has been created that has at least one route specified on it. This makes sense, as history management is only required if there are routes to respond to.

    http://tinnedfruit.com/2011/04/26/testing-backbone-apps-with-jasmine-sinon-3.html

提交回复
热议问题