私のメインテンプレートで
<body data-ng-controller="MainCtrl">
<div id="container" data-ng-class="{home: home}">
私のコントローラーで
.controller('MainCtrl',function($scope,$location) {
$scope.$on('$routeChangeSuccess', function (scope, next, current) {
if($location.path()==='/'){
$scope.home = true;
}
else{
$scope.home = false;
}
}
私の目標は、ルーターがIndexCtrlを実行している場合にのみクラスを設定することです
.config(function (CONFIG,$routeProvider) {
$routeProvider
.when('/', {
templateUrl: CONFIG.site.path_views + '/index/index.html',
controller: 'IndexCtrl'
})
}
もっと良い方法はないかと考えています。