I have an array with x items. I need to copy this items and add a few more, but when I show the items in the ng-repeat I copy the firsts again.
How can I delete the items and put the new in real time? I tried using
delete $scope.items
$scope.items = []
But It not works.
It seems very basic question but I can't find a solution :(
EDIT
In the function when I add new items
$scope.order = function(auxItems){
var auxTotal = $scope.items;
auxItems.map(function(bono){
auxTotal.push(bono);
});
When I do some some stuff to add the items definitely I return an array.
var bonosOrdenados = $scope.ordena(auxBonos);
bonosOrdenados.map(function(elemento){
elemento.map(function(bono){
$scope.items.push(bono);
})
});
And of course the items are duplicated because I don't knot how to control it.