Utilize the id in AngularJS to bring attention to a specific row within a table

I am brand new to using angularjs. I currently have a table structured like this:

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>

Now, I have an ID coming from the back-end. I need to find and highlight the row where the ID is equal to 1. In this case, the Temporary Id corresponds to the ID.

The table data looks like this:

Sr.No Document Score QuickScore Actions 1 abc 12 5 aa

If the ID matches 1, I want to dynamically highlight that specific row. Does anyone have any suggestions on how to achieve this? Thank you for your assistance.

Answer №1

One way to apply a CSS class to the <TR> element is by using the ngClass directive.

<tr ng-repeat="file in processResumeFiles"  ng-class="{'highlighterClass' : file.temporaryId == 1}">

Answer №2

To achieve proper highlighting, it is essential to utilize CSS. Your Angular code should only be responsible for signaling the row you wish to highlight in a manner that can be interpreted by the CSS code for effective highlighting.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What could be the reason for the malfunctioning of the "subscribe" button?

Whenever the subscribe button is clicked, it should send an email to the "subscriptions" section of the database. Unfortunately, when I click the button, nothing seems to happen. My understanding of this is very limited and I can't seem to troubleshoo ...

Overlay sliding seamlessly with text scrolling

I just joined this platform and I'm playing around with creating an overlay that slides up with text over an image. However, I'm encountering some issues with the positioning of the overlay. This is part of a responsive gallery where all images h ...

Is there a way to configure MaterialUI XGrid filters to target and filter by the renderCell parameters instead of the backend data source?

While utilizing MaterialUI XGrid to showcase rows of information, I am facing an issue with filtering. Currently, filtering can only be done based on the backend row values rather than what is displayed in the cell. For instance, consider a column named U ...

AngularJS and JQuery validated

I'm looking to achieve something similar to what was discussed in this thread: Angularjs directive wrapping ng-repeat Although I can make it work as shown in the thread, I encounter an issue when updating the dirs array using Angular (for example, w ...

What is the best way to incorporate multiple variables in a MySQL query when using Node.js?

I'm facing a challenge where I need to input student data into a table using the parent key as a foreign key. The parent information is included in the same JSON object, with an array of students inside it. My goal is to retrieve the parent Id from th ...

Keep a consistent square proportion within a horizontal adaptable design

I am currently working on creating a responsive material list view that consists of cards with images, text details, and user actions. The challenge I'm facing is that the height of the cards can vary due to the different textual details, and the widt ...

"Padding has not been recognized as a valid input value

I'm struggling with getting padding to be accepted by the browser when I style a card using Material-UI. const useStyles = makeStyles((theme) => ({ cardGrid: { padding: '20px auto' }, })) Unfortunately, the browser is not recogni ...

Is it possible for a submission of a form to modify the content length header, resulting in the request failing?

Issue Description: After binding a submit event to an AJAX post request in order to send a predetermined key-value pair to a PHP script, the expected message indicating successful communication is not received. Despite the fact that the submit event trig ...

What is the best way to replace all punctuation with spaces within a large text file using streaming in Node.js?

My goal is to search for all punctuation marks in text files of any size and replace them with spaces using Node.js. Given that the file may be large, I am utilizing read and write streams to break it into chunks before passing it to a function designed ...

Adding Data Definition Language (DDL) statements while making an AJAX call

Is there a way to automatically update the value of a drop-down list whenever a partial view is loaded via an AJAX call? Currently, the AJAX call successfully retrieves the necessary information, but the user still needs to manually change the location val ...

Caution: An invalid next.config.js file has been detected while running the Next.js project

Whenever I try to run my project, I encounter the following three warnings: 1- warn - We found some invalid options in your next.config.js file. The property webpack5 is not recognized and may cause issues (allowed properties are: amp, analyticsId, assetP ...

Getting PHP Data from AngularJS: A Step-by-Step Guide

I have successfully sent FormData from AngularJS to PHP, but I am struggling to figure out how to get the $base64 variable back into my AngularJS code. The documentation provided by AngularJS hasn't been very helpful in this regard. https://docs.angu ...

Should we retain the express variable for a specific purpose?

Being a developer who is still learning the ropes, I fail to understand the necessity of creating or retaining the express variable in an express/Node app. Instead of following this conventional approach: const express = require('express'); con ...

Arranging SVG icons in a row within the navigation bar

Having trouble aligning the icons side by side? Even with margin and padding adjustments, I couldn't get it right. I've scoured multiple sites for a solution but couldn't find one. As an attempt to fix this, I created a bar with aligned butt ...

Tips for incorporating data attributes into <figure> elements and retrieving them using CSS

Can we enhance a <figure> element by adding data attributes and then utilizing them in CSS? For example, I attempted figure { margin: 0 attr(data-margin %); } using <figure data-margin="15">...</figure> but it didn't yield the d ...

Determine whether the regex pattern is positioned at the start of the string or following a designated character

I am working with a regex pattern and need to verify if it matches at the start of a string, after a new line, or after a white space. Additionally, I want to ensure that the pattern also matches the end of the string, after a new line, or a white space. ...

Creating a variable by using a conditional operation in JavaScript

When the statement <code>name = name || {} is used, it throws a reference error. However, using var name = name || {} works perfectly fine. Can you explain how variable initialization in JavaScript functions? ...

Error occurred while making a request in React using Axios: TypeError - Unable to retrieve the 'token' property as it is undefined

After successfully receiving a token from logging in with React Redux, I attempted to authorize it using the token. However, an error occurred stating Axios request failed: TypeError: Cannot read property 'token' of undefined. The token is stored ...

Bug with IE lookahead in Regular Expressions

Currently, I am struggling to define the regular expression needed for proper validation in my ASP.NET validator. Although it works fine in Firefox, the sample string is not validating correctly in IE using the following expression: 12{2}12{0-9}1{12,13} ...

A guide to categorizing and tallying JSON data based on multiple keys within the past 30 days using JavaScript/jQuery

I am facing an issue while trying to display a chart and extract specific data from an array. My goal is to generate a chart based on three columns in a JSON array: Source, Campaign, and Date. The process involves grouping the data, counting it, and then ...