Javascript UI路由如何从不同的UI sref调用同一个子级
嗨,朋友们,我是新来的角度和用户界面路由。我被路由卡住了。 我已经完成了以下代码,工作正常 home.htmlJavascript UI路由如何从不同的UI sref调用同一个子级,javascript,angularjs,Javascript,Angularjs,嗨,朋友们,我是新来的角度和用户界面路由。我被路由卡住了。 我已经完成了以下代码,工作正常 home.html poStatus.html _________________________ <span> Hi iam from POStatus</span> accruView.html ______________________________ <span> Hi iam from Accru View</span> navigat
poStatus.html _________________________
<span> Hi iam from POStatus</span>
accruView.html
______________________________
<span> Hi iam from Accru View</span>
navigationBar.html
______________________________
<nav class="navbar">
<div class="navbar-container">
<ul class="nav navbar-nav">
<li><a href ui-sref="postatus">Open PO Status</a></li>
<li> <a href ui-sref="accruview">Accru View</a></li>
</ul>
</div>
</nav>
你好,来自POStatus的iam
www.view.html
______________________________
您好,我来自Account View
导航栏.html
______________________________
朋友们,我必须为navigationbar.html添加功能。
当我单击navigationbar.html中的菜单时,它应该只在“中”更改内容homeContent@home"观点。
例如,当我在homeContent.html中单击“打开采购订单状态”链接时,它应该会更改
'menubar@home“还有”homeContent@home"观点。
但当我从navigationbar.html点击“打开采购订单状态”链接时,它应该会改变
只有homeContent@home"观点。我不知道怎样才能前进。
我陷入困境,有人能帮我吗。sref指的是州名尼斯,rrd。这很好用。但你能保证这是正确的吗menubar@home'当我放入我的navigationbar.html时,视图将不会再次被调用。您的home.postatus状态中有视图-其中之一是menubar@home,因此毫无疑问,它将被调用。
<div >
<span class="home-heading"> Hello! Header</span>
</div>
<a ui-sref=".postatus"> Open PO Status </a>
<a ui-sref=".accruview" > Accru View </a>
.state('home', {
url: '/home',
views: {
'': {
templateUrl: 'home.html',
},
'menubar@home': {
templateUrl: 'header.html'
},
'homeContent@home': {
templateUrl: 'app/component/home/homeContent.html',
}
}
})
.state('home.postatus', {
url: '/postatus',
views: {
'menubar@home': {
templateUrl: 'app/component/navigation-bar/navigationBar.html'
},
'homeContent@home': {
templateUrl: 'app/component/po-status/poStatus.html'
}
}
})
.state('home.accruview', {
url: '/accruview',
views: {
'menubar@home': {
templateUrl: 'app/component/navigation-bar/navigationBar.html'
},
'homeContent@home': {
templateUrl: 'app/component/accru-view/accruView.html'
}
}
})
<span> Hi iam from POStatus</span>
accruView.html
______________________________
<span> Hi iam from Accru View</span>
navigationBar.html
______________________________
<nav class="navbar">
<div class="navbar-container">
<ul class="nav navbar-nav">
<li><a href ui-sref="postatus">Open PO Status</a></li>
<li> <a href ui-sref="accruview">Accru View</a></li>
</ul>
</div>
</nav>