[英]Angular 2 - Bootstrap - Collapse
My question is, that how can I create own id for all collapse item ? 我的问题是,如何为所有折叠项创建自己的ID?
The problem is that if I click somewhere in the list always the first item gets collapsed. 问题是,如果我单击列表中的某处,则总是第一项被折叠。 I try to give the div the data.id, but it doesn't works as well.
我尝试为div提供data.id,但效果不佳。
<div class="container">
<div *ngFor="let data of data.data">
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#{data.id}}">{{data.subject}}</a>
</h4>
</div>
<div id="{data.id}}" class="panel-collapse collapse">
<div class="panel-body">{{data.id}}</div>
<div class="panel-footer">{{data.name}}</div>
</div>
</div>
</div>
</div>
</div>
There is a mistake in below line . 下一行有一个错误。
<a data-toggle="collapse" href="#{data.id}}">{{data.subject}}</a>
and this line : 和这一行:
<div id="{data.id}}" class="panel-collapse collapse">
Curly bracket is missing here href="#{data.id}}
and here id="{data.id}}"
href="#{data.id}}
和id="{data.id}}"
缺少花括号
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.