search

Home  >  Q&A  >  body text

angular.js - angular angular-ui-route里$state.includes 写这个不起作用

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

过去多啦不再A梦过去多啦不再A梦2744 days ago666

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-15 17:15:20

    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>

    reply
    0
  • Cancelreply