Can you help me please? I want to set controller name which contains in scope of another controller.
JS file:
.controller('PageCtrl', [
'$http',
'$scope',
'$routeParams',
'$location',
function($http, $scope, $routeParams, $location){
switch($routeParams.page) {
case 'companies':
$scope.CurrentPageCtrl = 'CompaniesCtrl';
break;
default:
break;
}
}])
.directive('myPagecontent', function() {
return {
template: '<ng-controller ng-controller = "{{CurrentPageCtrl}}"></ng-controller>'
};
})
HTML file:
<ng-controller ng-controller = "PageCtrl">
<my-pagecontent></my-pagecontent>
</ng-controller>
And I get error:
angular.js:13642 Error: [ng:areq] Argument '{{CurrentPageCtrl}}' is not a function, got undefined