0
저는 Restangular를 사용하여 새롭고 내 서비스를 사용하여 약속을 해결하는 방법을 이해하지 못합니다. 내가 customGET
메서드를 반환하려고했지만 내 컨트롤러에서 응답이 어떻게 응답 데이터를 이해하지 못하는 restangular 리소스의 모든 메서드가 포함 된 개체입니다. 네트워크 활동과 검색된 데이터를 검사합니다.Restangular 리소스를 해결하는 방법
내 서비스
angular
.module('Form29')
.service('Form29Service', Service);
Service.$inject = ['Restangular'];
function Service(Restangular) {
this.serviceResource = Restangular.all('forms');
this.getForm29 = getForm29;
function getForm29(_month, _year, _type) {
var params = {
rut: '76195496',
month: _month,
year: _year,
type: _type
};
return this.serviceResource.customGET('',params);
}
}
내 컨트롤러
angular
.module('Form29')
.controller('Form29Controller', Controller);
Controller.$inject = ['Form29Service'];
function Controller(Form29Service) {
var vm = this;
vm.submitForm = submitForm;
function submitForm(month, year, type){
Form29Service.getForm29(month, year, type).then(showForm);
}
function showForm(response){
console.log(response);
}
}
return this.serviceResource.customGET ('', params);을 (를) 대체하려고 했습니까? 에 의해 this.serviceResource.get (params) – Silvinus