Stanislav Fateev2015-08-13 22:50:24
Stanislav Fateev, 2015-08-13 22:50:24

AngularJS $scope and array - bug or feature?

I'm almost a complete zero in JS, but I got someone else's code and I have to poke around. Faced strange behavior (in my opinion this is a bug).
In the controller I do
$scope.item = $scope.arrayFirst[i]
, then in the code -
And so 20 iterations. So, in some conditions that I can’t trace, when pushing one of the items in the array, o_0 disappears, that is, its length becomes one less. So far I have solved the problem like this:
$scope.item = angular.copy($scope.arrayFirst[i])
- it seems to work fine.
What could it be? Can angular somehow filter this array without my knowledge?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Sergey, 2015-08-13
Protko @Fesor

filter this array without my knowledge?

no, but the array can be modified from another part of the system, for example if it is passed into a directive.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question