سؤال

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