【发布时间】:2017-03-16 22:16:02
【问题描述】:
当我们在state3 中使用ui-router 概念时,我需要突出显示导航选项卡state1。 State3 在 state1 html 中。
下面是我的代码:
<nav>
<a ui-sref="state1" ui-sref-active="active">State 1</a>
<a ui-sref="state2" ui-sref-active="active">State 2</a>
</nav>
<div ui-view></div>
myApp.config(function ($stateProvider, $urlRouterProvider){
$stateProvider.state("state1", {
url: "#",
template: "<p>State 1 <a ui-sref='state3'>details</a></p>",
})
.state("state2", {
url: "#",
template: "<p>State 2</p>",
})
.state('state3', {
url: "#",
template: "<h2>state1 details</h2>",
});
});
谢谢。
【问题讨论】:
-
我不知道 ui-sref-active 的概念。但是通过使用 jquery 你可以做到。 jsfiddle.net/akhilap/2cbtLtdt/3
-
@AkhilaPrakash 很好,但我正在寻找 angularjs 解决方案
-
我会尽力帮助你的。
标签: angularjs html angular-ui-router