I am working on a dynamic form in angular where the data can be multiple paths with other data where on save, it needs to send multiple post requests to server. Is this possible in angular? Here is my 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 am not sure how i could save all the paths in a single post request. So essentially it has to be a json object with multiple object entirs such as
[{
location: 'france',
xxxx: true,
yyyy: false,
center: 'sales'
},
{
location: 'france',
xxxx: true,
yyyy: false,
center: 'sales'
}]
any help on angular http.post with multiple request will be great , do i need to queue up the requests with a timeout or add a callback and chain the request on success of the first request??
$http.post(url, arrayOfObjects)