title: Angular - splice removes anything but the needed object from the array
body: <p>I'm trying to remove contacts from my simple Phonebook app. However when I invoke the deletePerson function, I remove anything but the needed contact. Please show me my mistake guys.</p>
  
  <p>My contacts partial:</p>
  
  <pre><code>&lt;ul class="people-list"&gt;
      &lt;li showhideoptions ng-repeat="person in people | filter: search | 
                                     orderBy: 'name' | orderBy:'friend':true"&gt;
          &lt;h4&gt;
              &lt;span ng-show="person.friend==true" class="icon-star icon-left"&gt;&lt;/span&gt;
              &lt;span ng-show="person.friend==false" class="icon-user icon-left"&gt;&lt;/span&gt;
  
          {{person.name}}
  
          &lt;span ng-click="deletePerson($index)"
            class="icon-remove pull-right"&gt;&lt;/span&gt;
            &lt;/h4&gt;
  
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>My main controller with factory:</p>
  
  <pre><code>var app = angular.module('contactList');
  
  app.factory('simpleFactory', function(){
      var people = [
              {name: 'Collin', city: 'Omaha', friend: false},
              {name: 'Alice', city: 'New York', friend: false},
              {name: 'Pasha', city: 'Moscow', friend: true},
              {name: 'Denis', city: 'St. Pete', friend: true}
  
      ];
  
      var factory = {};
      factory.getPeople = function() {
          return people;
      };
  
      return factory;
  });
  
  app.controller('MainController', function ($scope, simpleFactory) {
  
  $scope.people = [];
  
  init();
  
  function init() {
      $scope.people = simpleFactory.getPeople();
  }
  
  $scope.addPerson = function() {
      $scope.people.push(
      {   name: $scope.newPerson.name, 
          city: $scope.newPerson.city,
          friend: false
      });
  };
  
  $scope.deletePerson = function($index) {
      $scope.people.splice($index, 1);
  }
    });
  </code></pre>
  
  <p><strong>UPD</strong></p>
  
  <p>I now understand that the filter</p>
  
  <pre><code> | filter: search | orderBy: 'name' | orderBy:'friend':true"
  </code></pre>
  
  <p>Makes my deleting process go crazy. If anyone could advise me on how to tackle this problem, I'd appreciate that!</p>