Angularjs loop trought $http.post

前端 未结 3 647
死守一世寂寞
死守一世寂寞 2021-01-06 23:51

When I loop through the $http post service for Angularjs

for (var i = 0; i < $scope.tagStyles.length; i++) {
  $scope.profilTag.tag = $scope.tagStyles[i].         


        
3条回答
  •  猫巷女王i
    2021-01-07 00:22

    It is happened because request makes asynchronously. Real requests are sending after all iterations have completeted. Try send copy of params like this

    $http.post('/ajouterProfilTag',angular.copy($scope.profilTag)) 
    

提交回复
热议问题