I read several answers about using the service $http
to access the properties file, but now I'm sure how it will correspond to this scenario. I created a service that returns the hostnames from the poperties file, the calling client for this service should make a blocking call to this service and only act when reading the properties file.
var serviceMod = angular.module('serviceModule',[])
.factory('configService', function($http){
return {
getValue: function(key){
$http.get("js/resources/urls.properties").success(function(response){
console.log('how to send this response to clients sync??? ' + response)
})
return ????
}
}
})
someOtherControllr.js
var urlValue = configService.getValue('url')
The problem I encountered is related to the nature of the aync service $http
. By the time the response is received by the callback, the main thread has already completed by doingsomeOtherController.js
source
share