【发布时间】:2015-09-30 23:18:58
【问题描述】:
我在 angularJS 中创建了一个工作表,如下所示:
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th class="col-xs-12" ng-click="sort('firstName')"> <span class="glyphicon sort-icon" ng-show="sortKey=='firstName'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
</th>
</tr>
</thead>
<tbody>
<tr ng-click="showModal($event, user.emailAddress)" dir-paginate="user in users|orderBy:sortKey:reverse|filter:search|itemsPerPage:5">
<td>
<div style="padding-top:1em">{{Product name}}
<div>
<div style="padding-top:1em">Complete target in:<span> 23 days</span>
</div>
<div>completion status: done</div>
</div>
<div style="padding-top:1em">Show more details</div>
<div ng-show='false'>some product description here</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
对于每个元素,我希望能够动态扩展产品详细信息 - 当他们单击 div 显示更多详细信息时,会显示包含产品详细信息的 div - 当用户再次按下按钮时,包含细节被隐藏了。
<div style="padding-top:1em">Show more details</div>
<div ng-show='false'>some product description here</div>
如何在 angularJS 中做到这一点。谢谢
【问题讨论】:
-
在我格式化之后,您可以看到您的标记结构有问题。你是用
ng-repeat建表吗?
标签: javascript jquery html css angularjs