棱角分明的js UI路由器嵌套意见 [英] angular Js ui router nested views
问题描述
链接,例如: http://goo.gl/jJBMZL
下面两种状态定义的。 1.家中,2。关于
Here two states are defined. 1. home , 2. about
家里有1视图viewA
home has 1 view viewA
大约有2次viewA和viewB但viewB是关于页面的子部分。我想告诉viewB about.html页面里面,而不是索引页。这可能吗。请提供plunkr链接的感谢。
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
推荐答案
您可以包括你的网页关于子level.html内部about.html使用NG-包括像为 -
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屋!