ttmcswg ttmcswg - 28 days ago 9
AngularJS Question

How to delete a table line in angular js?

I`ve got a problem to delete items from object.
I made a function for deleting,but unfortunetly it can only delete 1 number in object.Like if i have 2 tasks and i choose to delete 2nd it will delete 1st one.
No idea how to fix it:(

$scope.deleteTask = function(taskIndex){

Here`s another code blocks for easier understanding of my code:

<tr ng-repeat="task in tasks">
<button class="btn btn-danger" ng-click="deleteTask(task)">Delete</button>
<td><input type="checkbox" ng-model="statusCheck"> </td>
<td style="{{setStyleToTd(statusCheck)}}">{{statusChecker(statusCheck)}}</td>
<td><button class="btn btn-primary">Edit</button></td>

var taskInformation = [
taskName: "Test task"
, status: false

(I know there are lots of problems like mine but I didnt find a proper answer)

Answer Source

You should pass the id of the task not the task itself, try: