0
내 $ http 호출 결과를 다른 모델로 투영하여 서비스 호출에 대한 투영을 전역으로 만들고 싶습니다.
즉, 내 http/api 호출에서 얻은 결과는 내가 원하는 정확한 모델을 사용하지 않습니다.
서비스 클래스 내에서이 프로젝션을 어떻게 수행합니까?
angular.module('openart')
.factory('BritishLibraryApi', ['$http', function ($http) {
return {
getPage:function(page){
return $http({method:"GET",url:'/api/british-library/'+page})
.success(function(data){
//would like to do something here like
return data.results.map(function(i){
//project i into another model here
return {
};
});
});
}
};
}]);
'$ scope '컨트롤러에서? 여기서 약속을 되 찾으시겠습니까? – Whisher
과 서비스에서 다른 서비스를 넣을 수 –