In the function configyou do not have access to it, try using the method run.
var m2 = angular.module('m2', ['m1'])
.run(['test', function(test) {
alert(test);
}]);
You have access to a function config, this is a service provider for testyou to do
var m2 = angular.module('m2', ['m1'])
.config(['testProvider', function(test) {
alert(test);
}]);
This will usually be the case if you want to provide some configuration to your test service, which will be specific to the m2 module.
source
share