I want to include another module into my service, I have some constants / config related. My config module looks like:
angular.module('myApp.config', [])
.constant('EnvironmentConfig', {
"WindowsAzureADConfig": {
"tenant": "aaa.onmicrosoft.com",
"clientAppId": "xx-xx-xx-xx-xx",
"authority": "https://login.windows.net/aa.onmicrosoft.com",
"resourceUrl": "https://graph.windows.net/",
"redirectUrl": "http://localhost:4400/services/aad/redirectTarget.html"
},
"AppEndPointConfig": {
"tokenAccess": "aa-aa-a-a-aa",
"baseURL": "http://aa.aaa.aa/api/",
"paths": {
"bpath": "bpath/"
}
},
"PConfig": {
"ApiKey": "aaadd2dasdasdas23f44ffsfsdf",
"printerId": 244312
}
}
);
I have the following angularjs service:
(function () {
function MySrv(EnvironmentConfig) {
var mySrv = {};
var app = {
aFunction: function () {
console.log(EnvironmentConfig.authority); // getting undefined
}
};
mySrv.app = app;
return mySrv;
}
angular
.module('myApp') // if adding .module('myApp', ['myApp.config']) then I'm getting a blank screen
.service('MySrv', mySrv);
})();
Note that the module is included & defined before the service itself.
.module('myApp', ['myApp.config']). Not in the service .js but where you first create themyApp-module