0
안녕하세요 여러분, 저는 나머지 앱과 함께 Wordpress에서 만든 백엔드로 앱을 개발하고 있습니다.각도 및 구형으로 getList를 실행할 때 오류가 발생했습니다.
그러나 나는 응답을 구문 분석 할 수 없다. 그리고 나는 왜 이것이 json 응답의 종류라고 생각하는지, 왜 나는 setResponseInterceptor 메서드를 구현하는지에 대해 잘 모른다.
여기의 문제는 setResponseInterceptor가 디버그 코드를 추가했는데 weiner의 로그를 보지 못했다는 것입니다.
// The contents of individual model .js files will be concatenated into dist/models.js
(function() {
// Protects views where angular is not loaded from errors
if (typeof angular == 'undefined') {
return;
};
var module = angular.module('Provedores_floresModel', ['restangular']);
module.factory('Provedores_floresRestangular', function(Restangular) {
return Restangular.withConfig(function(RestangularConfigurer) {
RestangularConfigurer.setBaseUrl('https://public-api.wordpress.com/rest/v1/sites/www.bride2be.com.mx/');
RestangularConfigurer.setResponseInterceptor(function(response, operation, what, url){
var newResponse;
if (operation === "getList") {
newResponse = response.posts;
}
return newResponse;
});
});
});
})();
이 컨트롤러 :
{
"data": "",
"status": 0,
"config": {
"method": "GET",
"headers": {},
"url": "https://public-api.wordpress.com/rest/v1/sites/www.bride2be.com.mx/posts?type=ceremonia"
}
}