AngularJs: Have method return synchronously when it calls $http or $resource internally

后端 未结 5 1849
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 05:48

Is there a way to wait on a promise so that you can get the actual result from it and return that instead of returning the promise itself? I\'m thinking of something simila

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-29 06:28

    Use a .get() callback function to ensure you get a resolved resource.

    Helpful links:

    • Official docs
    • How to add call back for $resource methods in AngularJS

提交回复
热议问题