从Restangular POST获得响应

Has*_*ass 7 angularjs restangular

发送Restangular POST后如何获取响应对象?

 firstAccount.post("Buildings", myBuilding).then(function() {
   console.log("Object saved OK");
 }, function() {
  console.log("There was an error saving");
 });
Run Code Online (Sandbox Code Playgroud)

我正在尝试获取新的对象ID.

谢谢.

mgo*_*nto 17

我是Restangular的创造者.弗利姆是对的:).

在承诺中,您将获得从服务器返回的对象:)

firstAccount.post("Buildings", myBuilding).then(function(addedBuilding) {
   console.log("id", addedBuilding.id);
 }, function() {
  console.log("There was an error saving");
 });
Run Code Online (Sandbox Code Playgroud)

谢谢!