问题描述
angular 里$state.includes 写这个不起作用
问题解答
回答1:找到原因了,可能$scope作用域不够,应该用$rootScope
nameurl.controller.js
$rootScope.nameURL = $state.includes('nameURL.**');
这句话的意思是,所有nameURL和nameURL子页都会返回true
index.html
<li><a ui-sref='nameurl.about' ng-class='{active: nameURL}'>关于我们</a></li>