私のアプリケーションでは、データを保存するためのリクエストを行う必要がありますが(この要求は少し遅いですが)、ユーザーは同じ時間に別のリクエストを行うことができます最初の要求(非同期)。どうすれば他の人を待つことなく2つの要求をすることができますか?アングルの開始が要求されているのを待っています
私の遅いサービス:
app.service('PedSaveService',["$http", "$q","BASEURL",
function ($http, $q,BASEURL) {
var self = this;
self.Save = function (pedidoData) {
var deferred = $q.defer();
$http({method: 'POST',async: true, url: BASEURL.REST_SAVE, headers: {'Content-Type': 'application/json;charset=utf-8'}, data : pedidoData})
.success(function (response, status, headers, config) {
deferred.resolve(response, status, headers, config);
})
.error(function (response, status, headers, config) {
deferred.reject(response, status, headers, config);
});
return deferred.promise;
}
非同期リクエスト? – Weedoze
リクエストが非同期でないのはなぜですか? – devqon
はい、しました。 $ http async:trueで、モジュールに$ httpProvider.useApplyAsync(true);を追加します。しかし、それは動作しません。 –