[英]Highlight a row of a table using the id in angular-js
我是angularjs
。 我有一張桌子,就像-
HTML
<table class="table table-striped" id="manageResumeTable">
<thead class="text-center text-info text-capitalize">
<th class="text-center col-xs-1">Sr.No.</th>
<th class="text-center col-xs-4">Document</th>
<th class="text-center col-xs-1">Score</th>
<th class="text-center col-xs-1">QuickScore</th>
<th class="text-center col-xs-5">Actions</th>
</thead>
<tr ng-repeat="file in processResumeFiles">
<td class="text-center col-xs-1">{{ file.temporaryId }}</td>
<td class="view-orphan uploadResumeTableCellOverFlow col-xs-4">
{{ file.attributes.name }}
</td>
<td class="text-center col-xs-1">{{file.totalScore}}</td>
<td class="text-center col-xs-1">{{file.attributes.quickScore}}</td>
<td class="text-center col-xs-5">
<button class="btn btn-labeled btn-info" title="Annotate Un-annotated Words" ng-disabled="!file.attributes.isUploadedDocument" data-ng-click="getOrphans($index)">
<i class="fa fa-eye" aria-hidden="true"></i>
</button>
<button class="btn btn-labeled btn-info" title="Promote to Gold Standard" ng-disabled="!file.attributes.isCommitted || !file.attributes.isUploadedDocument" data-ng-click="markAsGoldStd(file.attributes.name)">
<i class="fa fa-share" aria-hidden="true"></i>
</button>
<button class="btn btn-labeled btn-info" title="Delete from Corpus" data-ng-click="deleteResume(file.attributes.name)">
<i class="fa fa-trash" aria-hidden="true"></i>
</button>
<button class="btn btn-labeled btn-info" title="Move to Archive" ng-disabled="!file.attributes.isCommitted || !file.attributes.isUploadedDocument" data-ng-click="moveToSolar(file.attributes.name)">
<i class="fa fa-sign-out" aria-hidden="true"></i>
</button>
<button class="btn btn-labeled btn-info" title="Add to Tracker" ng-disabled="!file.attributes.isCommitted || !isjdDeleted || !jdSelected"
data-ng-click="moveToJobDescription(file.attributes.name)">
<i class="fa fa-check-square" aria-hidden="true"></i>
</button>
</td>
</tr>
</table>
所以,現在我有一個來自back-end
的ID。 我想突出顯示id is 1
的行。 Temporary Id is the ID here
。
表數據就像-
Sr.No Document Score QuickScore操作1 abc 12 5 aa
在這里,當ID為1
我要突出顯示該行。 有人可以給我任何想法嗎? 謝謝您的幫助。
您可以使用ngClass
指令將CSS類添加到<TR>
<tr ng-repeat="file in processResumeFiles" ng-class="{'highlighterClass' : file.temporaryId == 1}">
實際的突出顯示應通過CSS完成。 因此,您的角度代碼應該只將要突出顯示的行上的調用設置為CSS代碼可以理解並為您突出顯示的內容
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.