I have got a problem with calling a controller(not just a function) from another controller. My HTML looks like:
<div ng-app="MyApp">
<div ng-controller="MyCtrl">
<div id="msg"></div>
</div>
</div>
And the script:
var module = angular.module('MyApp', []);
module.controller('MyCtrl', [function() {
angular.element(document).ready(function () {
test();
});
}]);
module.controller('test', [function() {
document.getElementById('msg').innerHTML = 'Hello';
}]);
Please see the jsfiddle here: http://jsfiddle.net/y35emhny/
Is there any way how I can achieve it?