Using UI-router, I have an abstract parent state with 6 child states. The child states are loaded using tabs on the parent state template. Using ng-class
, I want the active tab to be highlighted. I can set a $scope.active_tab
variable and change it every time the user clicks a new tab, but that won't work if a child state is navigated to directly via url.
You could use ui-sref-active directive, which allows you to add classes to an element when the related ui-sref state is active
<ul>
<li ui-sref-active="active" class="item">
<!-- ... -->
</li>
<!-- ... -->
</ul>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments