title: Edit Array on Swipe
body: <p>i am creating an app with a Swipe card interface using angularJS and ionic framework it will have similar functionality as this site  ( <a href="https://windowshopper.me/" rel="nofollow">https://windowshopper.me/</a> ) </p>
  
  <p>On swipeing to accept the card i want it to change my array so that  Done : False will change to Done : True.</p>
  
  <p>This will allow me to filter Done: True and display all cards which have been accepted in a list.</p>
  
  <p>Here is my code below
  HTML:</p>
  
  <pre><code>&lt;td-cards&gt;
      &lt;td-card ng-repeat="card in cards" on-destroy="cardDestroyed($index)" on-swipe-left="cardSwipedLeft($index)" on-swipe-right="cardSwipedRight($index)" on-partial-swipe="cardPartialSwipe(amt)" class="card-{{card.index}}" ng-controller="CardCtrl"&gt;
      &lt;h4 style="text-align:center"&gt; {{card.title}}&lt;/h4&gt;
        &lt;div class="image"&gt;
          &lt;div class="yes-text" ng-style="leftTextOpacity"&gt;Yes&lt;/div&gt;
          &lt;img ng-src="{{card.image}}"&gt;
          &lt;div class="no-text" ng-style="rightTextOpacity"&gt;No&lt;/div&gt;
        &lt;/div&gt;
        &lt;p&gt; {{card.desc}} &lt;/p&gt;
      &lt;/td-card&gt;
    &lt;/td-cards&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>//Controller for Cards
  .controller('CardsCtrl', function($scope, TDCardDelegate) {
    console.log('CARDS CTRL');
    var cardTypes = [
  {id: 1, title: "Frank", image: 'img/Frank.png', desc:"This will be card Description", done: true },
  {id: 2, title: "John Lewis", image: 'img/JohnLewis.png', desc:"This will be card Description", done: true },
  {id: 3, title: "Generali", image: 'img/Generali.png', desc:"This will be card Description", done: true },
   ];
  
  
  $scope.cards = Array.prototype.slice.call(cardTypes, 0);
  
  $scope.cardDestroyed = function(index) {
    $scope.cards.splice(index, 1);
  };
  
  $scope.addCard = function() {
    var newCard = cardTypes[Math.floor(Math.random() * cardTypes.length)];
    newCard.id = Math.random();
    $scope.cards.push(angular.extend({}, newCard));
   }
  })
  
  .controller('CardCtrl', function($scope, TDCardDelegate) {
    $scope.cardSwipedLeft = function(index) {
    console.log('LEFT SWIPE');
    $scope.addCard();
   };
  
  $scope.cardSwipedRight = function(index) {
    console.log('RIGHT SWIPE');
    $scope.addCard();
    };
  });
  </code></pre>