I have an angular rest service with the following structure
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();
};
}
also a controller
function countryCtrl(scope, countrySvc) {
scope.countries = countrySvc.countries();
}
but when I get access to countries from the controller, the result is empty with a successful data request, my question is how can I extract data from the answer with the correct promise template, i.e. (I need an array of countries when I access the .countries area)
source
share