bryan bryan - 6 months ago 17
AngularJS Question

Changing duplicate $scope array but it's affecting original ng-repeat

I have an ng-repeat that is cycling through


I have the following function:

var copy = $scope.myarray;

$.each(copy, function(index, data){ = "";

When I do this, it seems to be affecting my
loop on

When I do:


They both seem to have the
so I am thinking that is what is screwing things up.

What is the best way to manipulate my copy of the array without affecting the first version?


to copy you should use

var copy = angular.copy($scope.myarray);