title: AngularJS error when using splice()
body: <p>I am trying to delete a record both from scope and DB in angularjs but I am getting error. Although my record is deleting but not deleting in scope and shows error.</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'charAt' of undefined </p>
  </blockquote>
  
  <p>Here is my code.</p>
  
  <pre><code>&lt;a ng-click="deleteUser(user.id)"&gt;Delete&lt;/a&gt;
  </code></pre>
  
  <pre><code>$scope.deleteUser = function (uid) {
      if (confirm("Are you sure to delete this?")) {
          $http.post("functions.php?type=deleteUser&amp;uid=" + uid).success(function (data) {
              $scope.users.splice(uid, 1);
          });
      }
  };
  </code></pre>