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