0
我有2个按钮,都有ui-sref-active。在嵌套配置上关闭根用户状态的UI路由器的ui-sref-active
<a class="button" ui-sref-active="button-selected" ui-sref="main">
<p>View patients</p>
</a>
<a class="button" ui-sref-active="button-selected" ui-sref="main.create">
<p>Add patients</>
</a>
和CSS
.button-selected {
color: #0000FF;
}
我不知道为什么,当我点击符合国家“main.create”,班里的第2键“按钮,选择”不从第一去除一。所以颜色#0000FF仍然出现在第一个按钮上。看起来“主”状态始终处于活动状态。是因为它是根状态吗?什么是解决方法?
呜呼!非常感谢!为什么我找到的Angular docs使用ui-sref-active而不是ui-sref-active-eq? – devwannabe
您正在使用[ui-router](http://angular-ui.github.io/ui-router/site/#/api/ui.router) 对不对?可能是因为通常情况下,您正在使用ui-sref-active在校长状态之间进行时尚导航,而不是指定父母和他的孩子。 w ^ – Matho