AngularJS ui-router
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.0/angular-ui-router.js"></script>
<body ng-app="myApp" ng-controller="MyAppCtrl">
Calling another controller's method
</body>
JavaScript
/* myApp module */
var myApp = angular.module('myApp', []);
myApp.controller('anotherController', function ($scope) {
$scope.myMethod = function(param){
console.log('This is myMethod param: ' + param);
};
});
myApp.controller('MyAppCtrl', function ($scope, $controller) {
var anotherScope = $scope.$new();
$controller('anotherController', {$scope: anotherScope});
anotherScope.myMethod('Hello');
});