문제

I was wondering if I do something like this in AngularJS,

var myCat = cats.filter(function(comparedCat) {
    if(comparedCat.parentCategory != undefined) {
        return cat.id === comparedCat.parentCategory.id;
    }
});

and it returns a list of objects

[Object, Object, ...]

Are these objects referenced to the the objects in cats? In other words, if I change the subset of cats (returned array of objects), will it change the objects in cats?

도움이 되었습니까?

해결책

So I found out the myCat objects are actually references to objects in cats. That is so cool you can just change the objects returned to be reflected on the original objects.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top