如果我有这样的手风琴,我将如何使用索引附加到data-target
和id
所以不是所有的物品都会一次膨胀和收缩?
<div *ngFor="let item of items; let i = index">
<div class="accordion" id="accordion">
<div class="card">
<div class="card-header" id="heading">
<h2 class="mb-0">
<div class="btn btn-link collapsed"
data-toggle="collapse"
data-target="#collapse"
id = "card-head"
aria-expanded="false" aria-controls="collapse">
{{item.name}} {{item.lastName}}
</div>
</h2>
</div>
<div id="collapse" class="collapse" aria-labelledby="heading"
data-parent="#accordion">
<div class="card-body">
<p>{{item.content}}</p>
<button class="btn btn-primary btn-sm">Edit</button>
</div>
</div>
</div>
</div>
</div>