This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
ng-repeat loops over Array Like objects instance methods when length is 0 #13560
Closed
Description
Starting in angular 1.4.8 Array Like objects, ie Collection Classes which extend Array behave strangely in ng-repeat.
ng-repeat works correctly when length is > 0 and only loops over elements in the array but when length == 0 any non array element properties are looped over instead.
function BaseCollection(){}
BaseCollection.prototype = Array.prototype;
var child = new BaseCollection();
child.someProperty1 = true
child.someProperty2 = true
Even tho child is empty with length of 0 ng-repeat will loop over the 2 non element properties.
Works correctly in angular 1.4.7 but problem is reproducible in 1.4.8 and 1.5.0-rc.0