suchen

Heim  >  Fragen und Antworten  >  Hauptteil

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

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

过去多啦不再A梦过去多啦不再A梦2822 Tage vor716

Antworte allen(1)Ich werde antworten

  • 淡淡烟草味

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

    找到原因了,可能$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>

    Antwort
    0
  • StornierenAntwort