1

Want to confirm whether a controller from one module can be injected into another module? I know, we can inject the factory, services and etc from one module to another. But, can it be possible to access the stuff inside one controller into another controller of second module Ex:

// MODULE 1

var module1  = angular.module("module1", []);

module1.controller('module1Ctrl', function($scope){

$scope.print = function(){

    console.log('In module1');
  }
});

// MODULE 2

var mainModule = angular.module('mainModule',['module1']);

mainModule.controller('mainModuleCtrl', function($scope, **module1Ctrl**){

moduleCtrl.print(); // **Can be it's possible**

});

In HTML

<ng-app="mainModule" ng-controller="mainModuleCtrl"></>
Yogesh_D
  • 17,656
  • 10
  • 41
  • 55
undefined
  • 31
  • 1
  • 5
  • Possible duplicate of [How to call a function from another controller in angularjs?](https://stackoverflow.com/questions/29467339/how-to-call-a-function-from-another-controller-in-angularjs) – Karen Grigoryan Jun 15 '17 at 07:25

0 Answers0