Skip to main content
alternative solution
Source Link
user1334319
user1334319

According to MDN push.apply needs to be done from the prototype. Try:

Array.prototype.push.apply(
  $scope.priceSummaryRequest.Groups[0].Products,
  $scope.selectedProducts.Products);

Alternatively you can simply:

$scope.selectedProducts.Products.forEach(function(item){
      $scope.priceSummaryRequest.Groups[0].Products.push(item);
});

According to MDN push.apply needs to be done from the prototype. Try:

Array.prototype.push.apply(
  $scope.priceSummaryRequest.Groups[0].Products,
  $scope.selectedProducts.Products);

According to MDN push.apply needs to be done from the prototype. Try:

Array.prototype.push.apply(
  $scope.priceSummaryRequest.Groups[0].Products,
  $scope.selectedProducts.Products);

Alternatively you can simply:

$scope.selectedProducts.Products.forEach(function(item){
      $scope.priceSummaryRequest.Groups[0].Products.push(item);
});
make it readable
Source Link
jigfox
  • 18.2k
  • 3
  • 62
  • 74

According to MDN push.apply needs to be done from the prototype. Try:

Array.prototype.push.apply(
  $scope.priceSummaryRequest.Groups[0].Products,
  $scope.selectedProducts.Products);

According to MDN push.apply needs to be done from the prototype. Try:

Array.prototype.push.apply($scope.priceSummaryRequest.Groups[0].Products, $scope.selectedProducts.Products);

According to MDN push.apply needs to be done from the prototype. Try:

Array.prototype.push.apply(
  $scope.priceSummaryRequest.Groups[0].Products,
  $scope.selectedProducts.Products);
Source Link
user1334319
user1334319

According to MDN push.apply needs to be done from the prototype. Try:

Array.prototype.push.apply($scope.priceSummaryRequest.Groups[0].Products, $scope.selectedProducts.Products);