You have 2 angular modules, and one of those modules has a service that you want to use in the other module:
var moduleA = angular.module ('moduleA', [])
.service('FirstService', function(){
var thing = {};
thing.data = ['1', 'alskdjf' , 0];
return thing;
});
var moduleB = angular.module('moduleB', []);
The question is- how do you use 'FirstService', from within moduleB?
This fails:
moduleB.controller('MBC', ['$scope', 'moduleA', function($scope, moduleA){}])
These fail too:
moduleB.controller('MBC', ['$scope', function($scope){
var a = angular.injector().get('FirstService');
var b = angular.injector().invoke('FirstService');
var c = moduleA.service('FirstService');
var d = moduleA.FirstService;
}])
var moduleB = angular.module('moduleB', ['moduleA]);
This will inject moduleA into moduleB , and then you can use moduleA service.