我如何在两个子组件之间使 ngfor 中的 属性 值独立

How can i make a property value inside an ngfor independent, between two child components

当点击一个汽车品牌时,我需要它显示在底部,上面有人的名字,以及它最喜欢的汽车,上面点击了,但是当我点击一个时,汽车品牌是在 ngfor 的所有项目之间重复。

stackblitz 示例: https://stackblitz.com/edit/angular-ivy-rjdhkh?devtoolsheight=33&file=src/app/app.component.html

渲染 ngfor 中的每个组件时只需使用输入。 https://angular.io/guide/inputs-outputs

使用字典来保存每个人的值,使用他们的名字作为键。查看编辑后的 ​​stackblitz。

https://stackblitz.com/edit/angular-ivy-pachaq?file=src/app/app.component.ts