Friday, December 13, 2013

Drop something out of an array in JavaScript.

$scope.deleteAsset = function(asset) {
   console.log($scope.order.assets);
   $scope.order.assets.forEach(function(key) {
      if (key == asset.pKey) {
         $scope.order.assets.splice($scope.order.assets.indexOf(key), 1);
      }
   });
   console.log($scope.order.assets);
   $scope.save();
}

No comments:

Post a Comment