'How can i make a property value inside an ngfor independent, between two child components
When clicking on a car brand, i need it to be displayed on the bottom, where it has the name of the person, and its favorite car, cliked above, but when i click on one, the car brand is repeated between all items of the ngfor.
stackblitz example of it: https://stackblitz.com/edit/angular-ivy-rjdhkh?devtoolsheight=33&file=src/app/app.component.html
Solution 1:[1]
Use a dictionary to hold the values for each person using their name as the key. See the edited stackblitz.
https://stackblitz.com/edit/angular-ivy-pachaq?file=src/app/app.component.ts
Solution 2:[2]
Just use input when rendering every component in your ngfor. https://angular.io/guide/inputs-outputs
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | bjlasc01 |
| Solution 2 | Fernando |

