I am working on an Angular 5 project and I'm trying to filter an array.
I have an array of objects. An object has the property color. I am iterating over my array and I want to get all objects with the same color of my current object in the array. With the code below I seem to get only the first hit in the array and not all the elements.
This is my current code.
for(let object of this.objects){
let a: any = this.objects.find( a => a.color === object.color )
console.log(a);
// Do other stuff
}
Any idea how to solve this?
Thank you.