I have two modules tms2 and tms_sub . I need to access mainCtrl inside mCtrl. Is this possible.
Tms
var tms2 = angular.module('tms2', ['tms_sub']);
tms2.controller("mCtrl", ["$scope","$controller", function ($scope,$controller) {
$scope.test = "a1";
$scope.testClick = function () {
}
}]);
Tms_sub
var tms_sub = angular.module("tms_sub", []);
tms_sub.controller("mainCtrl", ["$scope", function ($scope) {
$scope.test ="a"
$scope.testClick1 = function() {
alert($scope.test);
}
}]);
How to call the function testClick1() form mainCtrl of tms_sub module inside function testClick(){} in mctrl of tms2 module.
$scope.testClick = function() {
testClick1()
}
}