angular.js - angular angular-ui-route里$state.includes 写这个不起作用
过去多啦不再A梦
过去多啦不再A梦 2017-05-15 17:13:20
0
1
668

angular 里$state.includes 写这个不起作用

过去多啦不再A梦
过去多啦不再A梦

reply all(1)
淡淡烟草味

I found the reason, maybe $scope is not enough scope, you should use $rootScope

nameurl.controller.js

 $rootScope.nameURL = $state.includes("nameURL.**");

This sentence means that all nameURL and nameURL subpages will return true

index.html

<li><a ui-sref="nameurl.about" ng-class="{active: nameURL}">关于我们</a></li>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template