javascript - how to post multiple requests using angular.js -
i working on dynamic form in angular data can multiple paths other data on save, needs send multiple post requests server. possible in angular? here html ,
<fieldset class="form-group pl-sm" ng-repeat="file in files"> <div> <input type="text" class="form-control" autocomplete="off" name="filelocation" ng-model="file.name"> </div> <input type="checkbox" class="switch-input" name="" ng-model="file.xxxx" /> <input type="checkbox" class="switch-input" name="" ng-model="file.yyyy" /> <div class="col-sm-3"> <select class="form-control" name="filecenters" ng-model="file.centers" required> <option value="development">development</option> <option value="sales">sales</option> </select> </div> </fieldset> <a href="" ng-click="addnew()">add more </a>
i not sure how save paths in single post request. has json object multiple object entirs such
[{ location: 'france', xxxx: true, yyyy: false, center: 'sales' }, { location: 'france', xxxx: true, yyyy: false, center: 'sales' }]
any on angular http.post multiple request great , need queue requests timeout or add callback , chain request on success of first request??
you not need send data multiple times server. on submit can send data @ once with
$http.post(url, array).then(function(response){ console.log(response.data); }).error(function(){ //if there error.. }).finally(function(){ //regardless of error or not, whatever u want })
Comments
Post a Comment