" Error: [ng:areq] Argument 'curController' is not a function, got string
当我尝试将变量放入 ng-controller 参数时,我收到一条消息
<div ng-include="templates[selected-1]" ng-controller='curController'>
控制器
for(i=0;i<$scope.cours.length;i++){
switch($scope.cours[i].type){
case "c1":
$scope.controllers[i]="cours1Display"
$scope.templates[i]="views/cours/cours1.html"
break;
case "c2":
$scope.controllers[i]="cours2Display"
$scope.templates[i]="views/cours/cours2.html"
break;
case "c3":
$scope.controllers[i]="cours3Display"
$scope.templates[i]="views/cours/cours3.html"
break;
case "c4":
$scope.controllers[i]="cours4Display"
$scope.templates[i]="views/cours/cours4.html"
break;
case "exo1":
$scope.controllers[i]="exo1Display")
$scope.templates[i]="views/exos/exo1Decorator.html"
break;
case "exo2":
$scope.controllers[i]="exo2Display"
$scope.templates[i]="views/exos/exo2Decorator.html"
break;
case "exo3":
$scope.controllers[i]="exo3Display"
$scope.templates[i]="views/exos/exo3Decorator.html"
break;
}
curController = $scope.controllers[0]
$scope.pageChanged=function(){
alert($scope.selected)
curController = $scope.controllers[$scope.selected-1]
}