Restriction을 사용하여 백엔드에서 JSON 객체를 검색하려고합니다.Restriction을 사용한 오류 처리
1)이 잘 작동,하지만 난 콜백/약속 기능이 없기 때문에 나는 오류를 처리 할 수있는 방법을 알고하지 않습니다
meals = restAngular.all('meal').getList({date: selectedDate}).$object;
다음은 약속 다음은 작동하지 않습니다
restAngular.all('meal').getList({date: selectedDate}).then(function(newMeals){
console.log(newMeals);
meals = newMeals;
});
내 Json 객체 대신 "newMeals"객체에 Restangular 객체가 있습니다. 뭔가 같은 :
addRestangularMethod: function(){var g=arguments,h=a?u:this; all: function() { [native code] } allUrl: function() { [native code] } clone: function() { [native code] } customDELETE: function() { [native code] } etc..
가 어떻게 약속을 사용하고 잠재적 인 오류를 처리 할 수있는, 내 JSON "식사"를받을 수 있나요?
2) 추가 질문 : Angularjs 1.2와 더 나은 새로운 $ 자원이 구현되었으므로 Restangular은 여전히 좋은 선택입니까?
덕분에 많은
정답입니다. 그것을 시도했다. 그것은 효과가 있었다. –