I have 2 controllers and I am calling the second controller from the function of first controller
$scope.open = function () {
var modal = $modal.open({
templateUrl: 'views/view1.html',
controller: 'controller2',
// other parameters
});
/* some code */
}
Both the controllers are in the same folder. There are similar questions but I want to know if there is any way I can call the second controller without using a service.
Edit --
This is the error I am getting --
Error: [ng:areq] Argument 'controller2' is not a function, got undefined http://errors.angularjs.org/1.3.16/ng/areq?p0=controller2&p1=not%20a%20function%2C%20got%20undefined at REGEX_STRING_REGEXP (angular.js:63) at assertArg (angular.js:1590) at assertArgFn (angular.js:1600) at angular.js:8502 at resolveSuccess (ui-bootstrap-tpls.js:2377) at processQueue (angular.js:13292) at angular.js:13308 at Scope.$get.Scope.$eval (angular.js:14547) at Scope.$get.Scope.$digest (angular.js:14363) at Scope.$get.Scope.$apply (angular.js:14652)
controller2is not found or what? - dfsq