Frage

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?

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top