I have a module and two controllers :
var module = angular.module("app", ["agGrid", "ngAnimate", "ngSanitize", "ngDialog"])
module.controller("mainCtrl", ["$scope", "dataService","$timeout","dateFilter","ngDialog", "$http", function ($scope, $http, $timeout, dateFilter, ngDialog, dataService) {
}]);
module.controller("modalCtrl", ["$scope", "ngDialog", "dataService", function ($scope, ngDialog, dataService) {
$scope.printEntity = function () {
    console.log(dataService.getEntityArray());
}
}]);
And a service:
 module.factory("dataService", function () {
var entityArrayService = [];
return {
    setEntityArray: function (entityArray) {
        entityArrayService = entityArray;
    },
    getEntityArray: function () {
        return entityArrayService;
    }
};
});
I can call dataService.setEntityArray(array) from inside my SECOND controller, but when i try to call this from my first controller it tells me dataService.setEntityArray is not a function