angularjs - 如何在 ng-repeat angularJs 中仅突出显示表的第一行?
问题描述
所以我想使用 ng-repeat 以不同颜色突出显示表格顶部的行。这是我的代码:
<table class="table table-hover" style="font-size:14px; margin-left: 5px;">
<thead>
<tr>
<th style="text-align: left;"><data-i18n i18n="_m_f_pen_feeding_start_date_">Feeding date</data-i18n></th>
<th style="text-align: left;"><data-i18n i18n="_m_f_pen_frequency_of_feeding_">Frequency of feeding</data-i18n></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="freq in vm.details.pen_feeding_scheduler_list | orderBy:'-start_feeding_date'">
<td style="min-width: 120px; text-align: left;">{{freq.start_feeding_date | date: 'MM/dd/yyyy'}}</td>
<td style="min-width: 120px; text-align: left; display: inline-block;white-space: nowrap">
{{freq.feeding_frequency || ('_label_empty_' | i18n)}}</td>
</tr>
</tbody>
</table>
这就是我的桌子的样子: table。有什么想法吗?提前致谢
解决方案
它必须为你工作<tr ng-repeat="data in datas" ng-class="$index===0?'hover':''">
........(hover
是类名)
推荐阅读
- javascript - 对于这种情况,最好或更好的实现(使用事件处理程序)是什么?
- python - Pymem 给出“找不到进程:GameAssembly.dll”,当这个进程据说存在于 Cheat Engine 中时
- wpf - WPF MVVM Datagrid 以前的值和新值
- selenium - How do I Extract ZIP code from a Website using selenium python
- javascript - 访问数据库时遇到问题。火力基地 9.0
- laravel - 在 Laravel 中使用 Postman 登录 Google
- camunda - Camunda 事件与 Pagerduty 的集成
- linux - 从核心转储中获取崩溃程序的命令行调用
- c# - EF Core 出现异常:“无法跟踪实体类型‘xxx’的”
- macos - MacOS 菜单栏中的 SwiftUI Picker 行为不一致 onRecieve()