I have knowledge about the different scopes within ng-repeat, I've heard about it but still can't figure out how to remove a selected item from the list without using $index and affecting future sortable objects.
<li class="m-1" ng-repeat="students in students.students">
<span>{{students.student}}</span> :knowledge is - <span>{{students.knowledge}}</span>
<button type="button" class="btn btn-danger ml-2" ng-click="students.removeItem(item)">Delete</button>
</li>
My function is working behind the li-element, but it only deletes the last element.
vm.removeItem = function (item) {
vm.students.splice(vm.students.indexOf(item), 1);
}
I am trying to achieve this without the need for $parent in ng-repeat.