gpt4 book ai didi

javascript - 将模板渲染到应用程序中无法在 Ember 上打开任何进一步的路由

转载 作者:行者123 更新时间:2023-11-28 08:10:13 25 4
gpt4 key购买 nike

我关注了这个answer渲染错误和 404 页面,我认为它工作正常,但后来我意识到我无法转到任何其他路线(通过单击 #link-to 链接),我每次都会收到这种错误,并且它不加载任何模板:

TypeError: Cannot read property 'connectOutlet' of undefined
at appendView (http://localhost:8000/assets/js/libs/ember.js:38926:19)
at EmberObject.extend.render (http://localhost:8000/assets/js/libs/ember.js:38742:9)
at EmberObject.extend.renderTemplate (http://localhost:8000/assets/js/libs/ember.js:38643:14)
at EmberObject.extend.setup (http://localhost:8000/assets/js/libs/ember.js:38083:16)
at handlerEnteredOrUpdated (http://localhost:8000/assets/js/libs/ember.js:41076:36)
at http://localhost:8000/assets/js/libs/ember.js:41045:18
at forEach (http://localhost:8000/assets/js/libs/ember.js:42113:54)
at setupContexts (http://localhost:8000/assets/js/libs/ember.js:41044:9)
at Object.Router.transitionByIntent (http://localhost:8000/assets/js/libs/ember.js:40747:13)
at doTransition (http://localhost:8000/assets/js/libs/ember.js:41300:21) ember.js:3910

Uncaught Error: Assertion Failed: TypeError: Cannot read property 'connectOutlet' of undefined

仅供引用,这就是我在 ApplicationRoute 中所做的事情:

this.render(template, {
into: 'application'
});

最佳答案

哦,没必要这么做。当抛出错误时,它会自动转到错误路径。 http://emberjs.com/guides/routing/loading-and-error-substates/#toc_code-error-code-substates-with-dynamic-segments

去掉这个,它会自动在失败的资源上方的资源中渲染错误路由

this.render(template, {
into: 'application'
});

http://emberjs.jsbin.com/jaxufiqu/1/edit

关于javascript - 将模板渲染到应用程序中无法在 Ember 上打开任何进一步的路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24299831/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com