简体   繁体   English

为什么我的Ember.Router给出了这个TypeError?

[英]Why is my Ember.Router giving this TypeError?

I'm using Ember built from git master. 我正在使用从git master构建的Ember。 My RouteManager is not complex, but when I try to start my app, I get this error: 我的RouteManager并不复杂,但是当我尝试启动我的应用程序时,我收到此错误:

Uncaught TypeError: Property '1' of object , is not a function 未捕获的TypeError:对象的属性“1”,不是函数

Following the trace indicates that this is happening on the app's initialization. 跟踪跟踪表明这是在应用程序初始化时发生的。

This jsfiddle shows the problem, although you'll have to look in the javascript console to see the error message. 这个jsfiddle显示了问题,虽然你必须在javascript控制台中查看错误消息。 My actual router will be more complex than this, but I've pared it down to the bones to try to eliminate potential error sources. 我的实际路由器将比这更复杂,但我已经削减了它的骨头,试图消除潜在的错误来源。

随着注入API的更改,您需要将您的Ember Data版本更新为master的最新版本。

Here is a fiddle which "works". 这是一个“有效”的小提琴。

http://fiddle.jshell.net/Sly7/ZySzK/ http://fiddle.jshell.net/Sly7/ZySzK/

I pick up an ember-data resource from another fiddle I found on stackoverflow. 我从stackoverflow上找到的另一个小提琴中获取了一个ember-data资源。

The way of populating the arraycontroller is weird. 填充arraycontroller的方法很奇怪。 Usually you pass the context in the connectOutlet method of the controller, by specifying a context (in your case, it should be Sylvius.Section.find() ) I don't know why, but doing this, I have the error 'Sylvius.Section has no method find'... perhaps an other mess due to ember-data/emberjs bad version. 通常你在控制器的connectOutlet方法中传递上下文,通过指定一个上下文(在你的情况下,它应该是Sylvius.Section.find())我不知道为什么,但这样做,我有错误'Sylvius .Section没有方法找到'...也许是因为ember-data / emberjs坏版本而导致的其他混乱。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM