Currently I work the insertions and deletions of registration with ajax
in the following way:
1.- I consult all the records that I have and I keep them in $scope.data
.
2.- Insert record in base de datos
and execute step 1.
3.- I delete record in BD
and execute step 1.
And in the view is something as simple as:
<li ng-repeat="item in data">
{{ item }}
</li>
The problem comes when I use ng-animate
since I want to have only the affected records animated, but as I reassign everything to the variable $scope.data
and that's why all the records encourage me.
I know I can use push
and pop
when inserting, if it is inserted correctly I do push
a $scope.data
the same with pop
, but in the system several people intervene that is why I am interested in bringing everything Is there a better way to do this?
Something like "consult all records and compare them with my varible
$scope.data
and so see that it was removed and inserted to only make changes to those elements and that way I only encourage the changes".