title: Using .splice to remove an item from an array is removing multiple objects
body: <p>I have created a page where users can select/ unselect employees. I am using <code>.push</code> to add these employees to an array, <code>users</code>. I am also using <code>.splice</code> to remove the unchecked item from the array. Currently, unchecking the last checked item works fine, however, if I select multiple items and uncheck the first item displayed in the view, it will remove every item from the array.</p>
  
  <p>Here is the HTML:</p>
  
  <pre><code>&lt;div ng-app="myApp"&gt;
    &lt;div ng-controller="MainCtrl"&gt;
      &lt;table&gt;
        &lt;tr ng-repeat="user in users"&gt;
          &lt;td&gt;&lt;input type="checkbox" ng-model="checked" ng-change="addremoveuser(checked, user.ID)"&gt;&lt;td&gt;
          &lt;td&gt;{{user.Title}}&lt;/td&gt;
          &lt;td&gt;{{user.FirstName}}&lt;/td&gt;
          &lt;td&gt;{{user.LastName}}&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is the JS:</p>
  
  <pre><code>var app = angular.module('myApp', ['ngSanitize']);
  app.controller('MainCtrl', function($scope, $http, $q){
      var users = [];
      $scope.addremoveuser = function (checked, id) {
          if (checked) {
              console.log("user selected", id);
              users.push(id)
              console.log("if test", users);
          }
          else {
              console.log("user unselected", id);
              var index = users.indexOf(id);
              users.splice(index);
              console.log("else test", users);
          }
      };
  });
  </code></pre>
  
  <p>How can I fix this to only remove the item that was unchecked?</p>