【发布时间】:2015-12-30 21:49:00
【问题描述】:
我已经看过一些关于使用$http 服务访问属性文件的回复,但现在确定它如何适合这种情况
我创建了一个从 poperties 文件返回主机名的服务,调用此服务的客户端应该对服务进行阻塞调用,并且只有在读取属性文件时才继续。
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')
我面临的问题与$http 服务的异步特性有关。当回调收到响应时,主线程已经执行完someOtherController.js
【问题讨论】:
-
我的建议对您有帮助吗?请分享您的发现
标签: javascript angularjs angularjs-service