我按照 the github page 上的示例进行操作Angular-ui-router 的。该示例运行良好,但我很困惑 ui-router 如何确定在何处插入部分状态 View 。关于Dive Deeper页面,上面写着
When a state is activated, its templates are automatically inserted into the
ui-view
of its parent state's template. If it's a top-level state—which 'contacts' is because it has no parent state–then its parent template is index.html.
但是,在我遵循的示例中,我找不到任何指示状态之间的父子关系的信息。例如,state1.list
的父级是什么?为什么?
非常感谢。
最佳答案
层次结构由点表示法确定
来自the docs, Nested States & Nested Views :
You can use dot syntax to infer your hierarchy to the $stateProvider. Below, contacts.list becomes a child of contacts.
$stateProvider
.state('contacts', {})
.state('contacts.list', {});
所以 state1.list
的父级是 state1
因为 ui-router 使用点表示法来确定父子关系。
关于javascript - `angular-ui-router` 如何确定在哪里插入状态 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21965557/