Simple to-do list, but with a delete button on list page for each item:
Relevant template HTML:
<tr ng-repeat="person in persons"> <td>{{person.name}} - # {{person.id}}</td> <td>{{person.description}}</td> <td nowrap=nowrap> <a href="#!/edit"><i class="icon-edit"></i></a> <button ng-click="delete(person)"><i class="icon-minus-sign"></i></button> </td> </tr> Relevant controller method:
$scope.delete = function (person) { API.DeletePerson({ id: person.id }, function (success) { // I need some code here to pull the person from my scope. }); }; I tried $scope.persons.pull(person) and $scope.persons.remove(person).
Although the database deleted successfully, I can not pull this item from scope and I do not want to make a method call to the server for data the client already has, I just want to remove this one person from scope.
Any ideas?
