I have a module (app.config) that I would like to add with my entire application.
The module must be available in all other modules embedded in the application.
For example, my application looks like this:
angular.module('myApp', [
'app.config',
'module#1',
'module#2',
'module#3',
'module#4'
])
.config...
/////////////////////////////////
Here app.config
angular.module('app.config', []).
constant('NAME1', 'Name1').
constant('NAME2', 'Name2');
////////////////////
I want "app.config" to be entered so that it can be accessed in all modules (module # 1 ',' module # 2 ', ....).
Here is my problem:
angular.module('module#1', []).
service('serviceOne', serviceOne);
function ServiceOne($http) {
var service = {
getMyProfile: function(){return $http.get('api/' + NAME1);}
};
return service;
}
Problem → NAME1 - undefined. But I thought I introduced it to the whole application.
I do not want to individually add app.config to each module. Any other solutions?