我跟着这个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'
});
答案 0 :(得分:0)
哦,没有必要这样做。抛出错误时,它会自动转到错误路由。 http://emberjs.com/guides/routing/loading-and-error-substates/#toc_code-error-code-substates-with-dynamic-segments
this.render(template, {
into: 'application'
});