javascript - How to delete a table line in angular js? -




i`ve got problem delete items object. made function deleting,but unfortunetly can delete 1 number in object.like if have 2 tasks , choose delete 2nd delete 1st one. no idea how fix it:(

 $scope.deletetask = function(taskindex){     $scope.tasks.splice(taskindex,1); } 

here`s code blocks easier understanding of code:

<tr ng-repeat="task in tasks">    <td>         <button class="btn btn-danger" ng-click="deletetask(task)">delete</button>    </td>    <td>{{task.taskname}}</td>    <td><input type="checkbox" ng-model="statuscheck"> </td>    <td style="{{setstyletotd(statuscheck)}}">{{statuschecker(statuscheck)}}</td>    <td><button class="btn btn-primary">edit</button></td> </tr>  var taskinformation = [ {     taskname: "test task"     , status: false     } ]; 

(i know there lots of problems mine didnt find proper answer)

you should pass id of task not task itself, try:

ng-click="deletetask($index)" 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -