在初始化之前调用根状态的connectOutlets? [英] connectOutlets from root state called before initialization?
问题描述
http://jsfiddle.net/pauldechov/89S5p/
在root的connectOutlets中, App
仍然似乎是 .initialize()
d。 connectOutlets不是用于根状态的? (为什么?)
In root's connectOutlets, the App
still seems un.initialize()
d. Is connectOutlets not intended to be used with the root state? (And why?)
如果我每次加载页面时都需要某些东西(例如pangratz的NavigationView,请执行以下操作:https://stackoverflow.com/a/11629977/363073 ),那么我需要像他一样拥有一个包含root.index的全局状态?
If I need something every time the page is loaded (such as in pangratz's NavigationView here: https://stackoverflow.com/a/11629977/363073), then I will need to have an all-inclusive root.index state like he does?
推荐答案
正如sly7_7所指出的那样,这仍然是一个开放的问题 - 显然功能被认为是可取的,但似乎需要一个不希望的黑客。
http://github.com/emberjs/ember.js/pull/941现在,您可以在子路径中使用所有路由,例如root.index,或者手动绑定控制器,而不是使用插件助手(例如:
As pointed out by sly7_7, this is still an open question -- apparently the functionality is considered desirable but seems to require an undesirable hack. http://github.com/emberjs/ember.js/pull/941
code> {{view App.NavigationView controllerBinding =App.router.navigationController}} )。
For now, either have all your routes in a subroute such as root.index, or manually bind the controller rather than using the outlet helper (e.g. {{view App.NavigationView controllerBinding="App.router.navigationController"}}
).
这篇关于在初始化之前调用根状态的connectOutlets?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!