angular ui-祖先兄弟的路由集视图
angular ui-route set view for ancestor's brother
我正在设计我的 UI-路由器页面。 view-body 包含 navs-view,并且 navs-view 由路由配置动态更改,但我无法更改 toolBar
视图。它只能在我在 view-body 视图上进行路由时工作。
我尝试使用'toolBar@'
,但它不起作用。
那么如何改变祖弟的看法呢?
导航视图代码:
导航配置
代码片段比图片更容易理解,但如果我正确准备好你的问题,两个视图目标:
<div ui-view="toolBar"></div>
<div ui-view ></div>
放在一个模板中。最有可能在 parent 模板 中(其中 parent 是状态 'main.navs'
)。然后您的视图定义 could/should 使用相对 (parent targeting) names
views: {
'' : {}
'toolBar': {}
}
甚至可以使用绝对值(但如果相对值足够好,则不是好的方法)
views: {
'@main.navs' : {}
'toolBar@main.navs': {}
}
这意味着,绝对是根据视图目标名称和状态名称构建的。
只有以防万一,那个视图目标是一个宏大的 parent 我们可以使用这个定义
views: {
'' : {}
'toolBar@main': {}
}
其中 toolBar
现在是 main
状态视图的一部分
View Names - Relative vs. Absolute Names
Behind the scenes, every view gets assigned an absolute name that follows a scheme of viewname@statename
, where viewname
is the name used in the view directive and state name is the state's absolute name, e.g. contact.item
. You can also choose to write your view names in the absolute syntax.
我正在设计我的 UI-路由器页面。 view-body 包含 navs-view,并且 navs-view 由路由配置动态更改,但我无法更改 toolBar
视图。它只能在我在 view-body 视图上进行路由时工作。
我尝试使用'toolBar@'
,但它不起作用。
那么如何改变祖弟的看法呢?
导航视图代码:
导航配置
代码片段比图片更容易理解,但如果我正确准备好你的问题,两个视图目标:
<div ui-view="toolBar"></div>
<div ui-view ></div>
放在一个模板中。最有可能在 parent 模板 中(其中 parent 是状态 'main.navs'
)。然后您的视图定义 could/should 使用相对 (parent targeting) names
views: {
'' : {}
'toolBar': {}
}
甚至可以使用绝对值(但如果相对值足够好,则不是好的方法)
views: {
'@main.navs' : {}
'toolBar@main.navs': {}
}
这意味着,绝对是根据视图目标名称和状态名称构建的。
只有以防万一,那个视图目标是一个宏大的 parent 我们可以使用这个定义
views: {
'' : {}
'toolBar@main': {}
}
其中 toolBar
现在是 main
状态视图的一部分
View Names - Relative vs. Absolute Names
Behind the scenes, every view gets assigned an absolute name that follows a scheme of
viewname@statename
, whereviewname
is the name used in the view directive and state name is the state's absolute name, e.g.contact.item
. You can also choose to write your view names in the absolute syntax.