角度 Js ui 路由器嵌套视图 [英] angular Js ui router nested views
问题描述
链接到示例:http://goo.gl/jJBMZL
这里定义了两个状态.1.家,2.关于
首页有 1 个视图 viewA
about 有 2 个视图 viewA 和 viewB,但 viewB 是 about 页面的子部分.我想在 about.html 页面内而不是在索引页面上显示 viewB .这可能吗.请提供 plunkr 链接,谢谢.
如果有多种视图并且每个视图都有子状态,最佳实践是什么
您可以使用 ng-include like as- 将您的页面 'about-sub-level.html' 包含在 'about.html' 中
我是关于页面
<div ng-include="'about-sub-level.html'">
更改您的路由,如下所示-
.state('about', {网址:/关于",意见:{视图A":{templateUrl: "about.html"}}})
希望可以帮到你..
link to example: http://goo.gl/jJBMZL
Here two states are defined. 1. home , 2. about
home has 1 view viewA
about has 2 views viewA and viewB but viewB is a sub part of about page. I want to show viewB inside of about.html page and not on index page. Is this possible. Please provide a plunkr link thanks.
what is the best practice if there are various views and each view has sub states
You can include your page 'about-sub-level.html' inside 'about.html' using ng-include like as-
<h1>I am about page</h1>
<div ng-include="'about-sub-level.html'"> </div>
Change your routing like below-
.state('about', {
url: "/about",
views: {
"viewA": {
templateUrl: "about.html"
}
}
})
Hope this may help you..
这篇关于角度 Js ui 路由器嵌套视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!