Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs Angular UI sref active正在使用抽象父状态?_Angularjs_Angular Ui Router - Fatal编程技术网

Angularjs Angular UI sref active正在使用抽象父状态?

Angularjs Angular UI sref active正在使用抽象父状态?,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我在指令中创建一个侧栏,并将ui sref active=“active”附加到所有元素 我必须针对我的状态出现问题,或者抽象父状态导致ui sref active指令无法工作 在我的路线中,我有: $stateProvider. state('main', { url: '', abstract: true, template: '<div ui-view=""></div>', resolve:{ otherCharts: function($

我在指令中创建一个侧栏,并将
ui sref active=“active”
附加到所有元素

我必须针对我的状态出现问题,或者抽象父状态导致ui sref active指令无法工作

在我的路线中,我有:

$stateProvider.
state('main', {
  url: '',
  abstract: true,
  template: '<div ui-view=""></div>',
  resolve:{
    otherCharts: function($q, $timeout, secondaryCharts){
      var deferred = $q.defer();
      var charts;
      $timeout(function() {
        charts = secondaryCharts.getSecondaryCharts();
        deferred.resolve(charts);
      }, 250);
      return deferred.promise;
    }
  }
}).
state('dashboard', {
  parent: 'main',
  url: '/dashboard/',
  templateUrl: '/app/free/templates/dashboard.html',
  controller: function($scope, secondaryCharts){
    $scope.secondaryCharts = secondaryCharts.getSecondaryCharts();
  },
  data: {
    name: 'Dashboard'
  }
}).
state('growth', {
  parent: 'main',
  url: '/dashboard/growth',
  templateUrl: '/app/free/modules/donor-growth/donor-growth.html',
  controller: 'make-donor-growth',
  data: {
    name: 'Donor Growth',
    id: 0,
    type: 'chart'
  }
})
$stateProvider。
州('main'{
url:“”,
摘要:没错,
模板:“”,
决心:{
其他图表:函数($q,$timeout,secondaryCharts){
var deferred=$q.deferred();
var图;
$timeout(函数(){
charts=secondaryCharts.getSecondaryCharts();
延迟。解决(图表);
}, 250);
回报。承诺;
}
}
}).
状态('仪表板'{
父项:'main',
url:“/dashboard/”,
templateUrl:“/app/free/templates/dashboard.html”,
控制器:功能($scope,secondaryCharts){
$scope.secondaryCharts=secondaryCharts.getSecondaryCharts();
},
数据:{
名称:“仪表板”
}
}).
州(“增长”{
父项:'main',
url:“/dashboard/growth”,
templateUrl:“/app/free/modules/provider growth/provider growth.html”,
控制员:“促进供体生长”,
数据:{
名称:“捐赠增长”,
id:0,
键入:“图表”
}
})
然后,在我的html中,我有:

<li ui-sref="dashboard" ui-sref-active="active" href="/dashboard/"   class="title Dashboard"><a "ui-sref="dashboard" href="/dashboard/"><i class="fa fa-tachometer"></i>Dashboard</a></li>
  • 但是,当我处于特定状态(如myapp.com/dashboard)时,不会添加活动类。。针对我的州,我哪里做错了

    提前谢谢