发送Restangular POST后如何获取响应对象?
firstAccount.post("Buildings",myBuilding).then(function() { console.log("Object saved OK"); },function() { console.log("There was an error saving"); });
我正在尝试获取新的对象ID.
谢谢.
我是Restangular的创造者.弗利姆是对的:).
在承诺中,您将获得从服务器返回的对象:)
firstAccount.post("Buildings",myBuilding).then(function(addedBuilding) { console.log("id",addedBuilding.id); },function() { console.log("There was an error saving"); });
谢谢!