-1

" Error: [ng:areq] Argument 'curController' is not a function, got string変数を ng-controller param に入れようとすると、「」というメッセージが表示 されます

    <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]
}
4

1 に答える 1