I have a directive where a controller is defined and there is a variable say "$scope.accesJson". I need to access it from another controller.
Code:
angular.module('test.directives').directive("manageAccess", function() {
return {
restrict: "E",
replace: true,
templateUrl: "template/test.html",
controller: function($scope, $element, $http) {
$scope.accesJson = ["hi","hello"];
}
};
});
I have another controller,
angular.module("test.controllers").controller("testController", function($scope, $http) {
$scope.getUsers = function() {
console.log $scope.accesJson //I need value of $scope.accesJson here.
}
});
How can I do that?
Please help, Thanks