Запросы выполняются не последовательно AngulaJS, а все одновременно
Почему 3 POST запроса отправляются одновременно?
var app = angular.module("LOGIN",[]);
app.controller("LOGIN_CONTROLLER",function($scope, $http, $filter){
$scope.ulrUpdate = "/currency/update"
$scope.date = new Date();
$scope.date = $filter('date')($scope.date, 'yyyy-MM-dd');
$scope.update = async function() {
await update1();
await update2();
await update3();
// Observable.forkJoin(
// [update1(),
// update2(),
// update3(),]
// ).then(function (response) {
// alert("Okay")
// })
}
$scope.delete = async function () {
$http({
url: '/currency/clear',
method: 'DELETE',
}).then(function (response) {
console.log(response)
})
}
update1 = async function () {
return $http({
url: '/currency/update',
method: 'POST',
data: {
dateEntryClient: $scope.date,
base: "EUR",
symbols: "USD"
}
}).then(function (response) {
})
}
update2 = async function () {
return $http({
url: '/currency/update',
method: 'POST',
data: {
dateEntryClient: $scope.date,
base: "USD",
symbols: "RUB"
}
}).then(function (response) {
})
}
//
update3 = async function () {
return $http({
url: '/currency/update',
method: 'POST',
data: {
dateEntryClient: $scope.date,
base: "EUR",
symbols: "RUB"
}
}).then(function (response) {
})
}
});