【发布时间】:2014-07-09 20:26:25
【问题描述】:
我有一个具有以下结构的休息角服务
function countrySvc(restangular) {
restangular.addResponseInterceptor(function (data, operation, what, url, response, deferred) {
if (operation === 'getList') {
var newResponse = response.data;
return newResponse;
}
return response;
});
var baseCountry = restangular.all('country');
this.countries = function() {
baseCountry.getList();
};
}
也是一个控制器
function countryCtrl(scope, countrySvc) {
scope.countries = countrySvc.countries();
}
但是当我从控制器访问国家/地区时,结果为空且成功请求数据,我的问题是如何从具有适当承诺模式的响应中提取数据,即(当我访问范围时我需要国家/地区数组.国家)
【问题讨论】:
标签: angularjs asp.net-web-api restangular