I get Cannot call 'start' of undefined
when calling...
Backbone.history.start()
When running some checks Backbone returns the object but Backbone.history returns undefined.
What could be the cause of this?
Thanks
I get Cannot call 'start' of undefined
when calling...
Backbone.history.start()
When running some checks Backbone returns the object but Backbone.history returns undefined.
What could be the cause of this?
Thanks
I faced exact same issue for different reason, after spending couple of hours i realized that a method in my router "route" : function() is causing the issue, after i comment this unnecessary extra method, history.start() worked as expected.
Make sure you include
jQuery.js
beforeunderscore.js
andbackbone.js
in HTML head.I hit the same error.
This happens when you do not make an instance of the router:
If you're using CoffeeScript and your Router is defined using the CoffeeScript class keyword with a constructor method, double check that you invoke super in the definition of the constructor. This resolved the issue of Backbone.history being null for me.
Do you have any routes on the controller? Backbone only creates the history once at least one route is specified.
More:
http://tinnedfruit.com/2011/04/26/testing-backbone-apps-with-jasmine-sinon-3.html