如何取消RestAngular promise .then()?我不知道如何在restangular / $http中取消promise / xhr请求 – 这在jQuery中相当简单.
您可以通过timeout config
属性中止$http
调用,该
属性可以是Promise,在解析时中止请求.
所以在restangular中,你可以这样做
var abort = $q.defer();
Restangular.one('foos',12345).withHttpConfig({timeout: abort.promise}).get();
abort.resolve();
希望这可以帮助!