2016-01-13 27 views
1

我使用AngularJS ui路由器,我有我從菜單1和菜單2可到達的子菜單的問題。 是否有可能突出顯示菜單1菜單2AngularJS ui路由器 - 設置菜單活動

Menu1: ng-class="{'active': vm.state.includes('auth.Menu1') || vm.state.includes('auth.SubMenu')}" 
Menu2: ng-class="{'active': vm.state.includes('auth.Menu2') || vm.state.includes('auth.SubMenu')}" 
+0

的[添加使用裝飾角指令(可能的複製http://stackoverflow.com/questions/34686823/adding-angular-directive-使用裝飾) – vittore

+0

什麼關於http://stackoverflow.com/questions/17215656/how-to-detect-current-state-within-directive/17225152#17225152 –

+0

@SeanLarkin有其他問題不只是這兩個 – vittore

回答

1

人們一直在問這個問題,你應該使用ui-sref-active指令

+0

找到dup和國旗作爲笨蛋! :-D –

+0

http://stackoverflow.com/questions/17215656/how-to-detect-current-state-within-directive/17225152#17225152 –

+0

我已經刪除了ui-sref-active,因爲我不知道如何去用這個指令來實現它。 – quma