I need to set global config variable for my App populated with $http.get(url);
.run(['$http', '$rootScope','rootService', function($http, $rootScope, rootService) {
rootService.getApplicationConfig().success(
function(data, status) {
$rootScope.appSettings = data;
}
);
I can use it in html with {{appSettings.SomeValue}}. The problem that .run method executes after .config. And in controllers appSettings is undefined.
How can I get this working in controllers? Or make global variables, which would be populated only once startup.