Iterating through a range using lodash/AngularJS and saving data
Please do not make separate calls (Http requests) for saving each container,as this will affect the web application performance. Instead batch the calls ( 5 calls at one time). Store them in an array and make a single call

_.each($scope.batchFields, function(batch) {
  var containersList = [];
  _.each(_.range(batch.batchesQuantity, 0, -1), function(val, i) {

    // store them in the array
    containersList.push(new Container($scope.batchFields));
  });


  $http.post('saveContainers', containersList).then(function(response) {
    $notify.success('purchase.order.edit.created');
    if ($scope.$close) {
      $scope.$close();
    }
  }, function(errorResponse) {
    $scope.errors = errorResponse.data.message;
  });

});