Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top