I have the following:
sample collection of objects
var myObjects = [
{ name: "Object1", shape: "circle", color: "red" },
{ name: "Object2", shape: "square", color: "orange" },
{ name: "Object3", shape: "triangle", color: "yellow" },
{ name: "Object4", shape: "circle", color: "green" },
{ name: "Object5", shape: "sphere", color: "blue" },
{ name: "Object6", shape: "hexagon", color: "indigo" },
{ name: "Object7", shape: "square", color: "violet" }
];
I get an array of just the objects matching specific criteria.return an array with only red objects
var myRedObjects = $filter('filter')(myObjects, { color: "red" });
Now my problem is that how I can update filter object name in array myObjects.
filter
, it will return a new array and references of object. You can manually loop over array and set if matching value is found – Rajesh 31 mins ago