Hi,

$scope.delete = function (passYourIdToDeleteItem) {

    var DeleteItem = $scope.persons[(passYourIdToDeleteItem) ];

    API.DeletePerson({ id: DeleteItem }, function (success) {

        $scope.persons.splice(passYourIdToDeleteItem, 1);
    });
};

On Monday, December 28, 2015 at 8:02:16 PM UTC+5:30, ShatterStar wrote:
>
> I have a list with a delete button that is attached to each item like this
>
>  <table>
>  <tr>
>  <th>Date</td>
>  <th>Detail</td>
>  <th>Amount</td>
>  </tr>
>  <tr ng-repeat="item in list" >
>  <td>{{item.date}}</td>
>  <td>{{item.detail}}</td>
>  <td>{{item.amount}}</td>
>  <td><a class="noUnderline" href=
> "#/editExpense/{{$index}}/{{item.date}}/{{item.detail}}/{{item.amount}}"
> ><button>Edit</button></a></td>
>  <td><button ng-click="deleteExpense($index)">Delete</button></td>
>  </tr>
>  </table>
>
> upon clicking the delete button I want that particular item in the object 
> that I have declared to be removed / deleted, here's my object
>
>  $scope.list = [ 
>  { date: "2015-12-01", detail: "Bought new wallet", amount: $filter(
> 'number')(150.00 , 2) },
>  { date: "2015-12-08", detail: "Bought shoes", amount: $filter('number')(
> 225.36 , 2) },
>  { date: "2015-12-12", detail: "Bought shirt", amount: $filter('number')(
> 300.89 , 2) },
>  { date: "2015-12-12", detail: "Paid electricity bill", amount: $filter(
> 'number')(190.9 , 2) },
>  { date: "2015-12-15", detail: "Paid phone account", amount: $filter(
> 'number')(115.00 , 2) }
>  ];
>
> how do I go about doing this?
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to