Hey there, I'm facing an issue with Angular where I need to retrieve a specific object from an array based on its ID. I'm quite lost on how to approach solving this problem.
var Obj = [
{ Id: "1", shape: "circle", color: "red" },
{ Id: "2", shape: "square", color: "orange" },
{ Id: "3", shape: "triangle", color: "yellow" },
{ Id: "4", shape: "circle", color: "green" },
{ Id: "5", shape: "sphere", color: "blue" },
{ Id: "6", shape: "hexagon", color: "indigo" },
{ Id: "7", shape: "square", color: "violet" },
{ Id: "8", shape: "triangle", color: "red" }
];
For instance, the function should look something like this:
And scope.result should be like:
scope.result = [
{ Id: "3", shape: "triangle", color: "yellow" }
];