不能叫'启动'的不确定开始Backbone.js的历史的时候。 [英] Cannot call 'start' of undefined when starting backbone.js history.

查看:76
本文介绍了不能叫'启动'的不确定开始Backbone.js的历史的时候。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到无法调用'开始'未定义打电话时...

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

    Backbone.history.start()

在运行某些检查骨干返回对象,但Backbone.history返回undefined。

When running some checks Backbone returns the object but Backbone.history returns undefined.

什么可能是这个原因吗?

What could be the cause of this?

感谢

推荐答案

你有没有在控制器上的路线?骨干仅创建被指定一次的至少一个路线的历史记录。

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

更多:

类型错误:无法调用的方法未定义'开始'**

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

嗯,由于某种原因,Backbone.history是未定义的,并且因此没有
  它开始的方法。事实证明,Backbone.js的创建一个实例
  Backbone.History(大写'H')称为Backbone.history(下
  情况下的h)一旦控制器已经创建了具有至少一个
  航线上指定。这是有道理的,因为历史管理只
  如果有路由响应必需的。

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.

<一个href=\"http://tinnedfruit.com/2011/04/26/testing-backbone-apps-with-jasmine-sinon-3.html\">http://tinnedfruit.com/2011/04/26/testing-backbone-apps-with-jasmine-sinon-3.html

这篇关于不能叫'启动'的不确定开始Backbone.js的历史的时候。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆