我正在嘗試對(duì)我從我的角度應(yīng)用程序進(jìn)行的 $http.get 調(diào)用使用承諾鏈接$http.get(url, config) .then(newViewRequest) .then(function (response) { // success async $scope.viewRequest1.data = response.data; }在我的 newViewRequest 中,我對(duì)其他端點(diǎn)進(jìn)行了新的調(diào)用,如果 newViewRequest 中的調(diào)用成功,我只需要發(fā)回響應(yīng)。以下是我正在嘗試的var newViewRequest = function (response) { var url1 = $rootScope.BaseURL; var config = { headers: { 'Authorization': `Basic ${$scope.key}`, 'Prefer': 'odata.maxpagesize=2000' } }; var newresponse = $http.get(url1, config); if (newresponse.status = 200) return newresponse; else return response;};但它總是發(fā)送請(qǐng)求響應(yīng)而不驗(yàn)證狀態(tài)或任何東西。我該如何解決這個(gè)問題。
Promise Chaining 未按預(yù)期工作
qq_笑_17
2021-08-20 19:20:58