扫码关注官方订阅号
angular 里$state.includes 写这个不起作用
找到原因了,可能$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>
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
找到原因了,可能$scope作用域不够,应该用$rootScope
nameurl.controller.js
这句话的意思是,所有nameURL和nameURL子页都会返回true
index.html