1
我有一個搜索框,並且每個用戶類型的字母都有4個API調用。 並且如果用戶輸入一個長字,許多API調用進入暫掛狀態。與每個新的信件哪個用戶類型我如何檢查和取消,如果以前的呼叫處於未決狀態。如何在Angular JS中取消待處理的API調用
FController.prototype.typeAheadSearch = function (query) {
var this_ = this;
var dfd = this.$q.defer();
this.$q.all([this.TypeAheadFactory.API.A(query),
this.TypeAheadFactory.API.B(query),
this.TypeAheadFactory.API.C(query),
this.TypeAheadFactory.API.D(query)])
.then(function (responses) {
// to do
dfd.resolve(results);
});
return dfd.promise;
}
它將如何幫助取消呼叫? – janIreal23