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

The call function in Tween.js fails to execute after adding an EventListener

I encountered an issue while using tween.0.6.2. The following code snippet (borrowed from the tween.js Getting Started page and slightly simplified) works perfectly: createjs.Tween.get(circle) .to({x: 400}, 1000, createjs.Ease.getPowInOut ...

Guide on displaying a real-time "Last Refreshed" message on a webpage that automatically updates to show the time passed since the last API request

Hey all, I recently started my journey into web development and I'm working on a feature to display "Last Refreshed ago" on the webpage. I came across this website which inspired me. What I aim to achieve is to show text like "Last Refreshed 1 sec ago ...

Guidelines for displaying user profile information in the dashboard page through an Angular project, considering the different user types (user, super user, admin)

In my application, I have implemented the dashboard feature. There are three types of dashboards: the regular user dashboard, super user dashboard, and admin dashboard. The super user and admin dashboards include additional tables along with the data from ...

Receiving an UNDEFINED INDEX error when trying to send data from an HTML form to a

I've created an HTML form that is styled using CSS for weekly work data entry. <form action="wwinsert.php" method="post"> <fieldset> <legend>Weekly Work</legend> <p><label class="lab1" for="StoreNumber">Store:</ ...

fnRedraw and fnReloadAjax do not have the capability to refresh the datatable

I have been working on updating a table with new data from an ajax url. The table loads correctly the first time, but I am struggling to get it to refresh. $(function() { var datepicker = $( "#date-picker" ); var table = $("#reports1").dataTable( ...

Ensure your mobile device is age 13 or over before proceeding

I am developing a project with Next js. Here, I want to render a component if it is a mobile device. However, if I use the isMobileDevice value in jsx, I get the errors below. import useTranslation from "next-translate/useTranslation"; import isM ...

Issues with Ajax calls not functioning properly within CakePHP

I'm attempting to make an AJAX request in CakePHP. The submit button is marked as #enviar and the action as pages/contato. This is the code for my AJAX request: $(document).ready(function() { $('#enviar').click(function(){ $. ...

I am having trouble showing the background image in the div

I created a 960 layout using 3 divs to easily organize child divs with images and text. However, I'm having trouble getting the background image of the first div to display. Can you help me figure out what I'm doing wrong? This is the concept f ...

The issue with Google Maps not functioning properly at 100vh has been identified specifically on Android app

#map-canvas {height: 100vh; width: 100vw;} <ion-view title="Truck Map"> <ion-nav-buttons side="left"> <button menu-toggle="left" class="button button-icon icon ion-navicon"></button> </ion-nav-buttons> < ...

Blurring the background creates an "inset shadow" problem when transitioning

Problem: Strangely, when using Backdrop-filter: blur(Xpx); during a transition as shown below, unexpected "inset Shadows" mysteriously appear until the end of the transition. https://i.stack.imgur.com/uij7F.gif Illustration of the Issue Using jsfiddle Sp ...

Expanding the CSS Search Box

Visit the link I've been working on coding a CSS text box. When you hover over the button in the provided link, you'll notice that the 'Type to search' functionality is working smoothly as it moves to the right. My current focus is on ...

Ways to improve the quality of a blurred photo

I've recently put together a test landing page using bootstrap: Upon visiting the site and viewing the iPhone screenshot, it's clear that the text on the screen is quite blurry. Interestingly, by simply resizing the browser window and then maxi ...

What exactly is the purpose of utilizing node js and can someone explain to me what constitutes a

After mastering HTML and CSS, I've started diving into JavaScript. However, I'm curious about Node.js. What exactly is it, why do I need it, and can you explain what a framework is in general? Sorry if these questions sound silly! ...

Vue.js will trigger the updated() method only when a particular array undergoes changes

Working on a chat feature and looking for a way to automatically scroll to the end of the conversation when new messages are added. The current solution involving the updated() function works well, but there's a complication with a vue-timepicker com ...

In order to check a checkbox, you need to ensure that the scrolling div has been scrolled to the very

I have a situation where I need to ensure that a user has scrolled to the bottom of a disclaimer before they can acknowledge it by checking a checkbox. Our legal department requires this extra step for compliance reasons. Here is an example of how the mark ...

Using dynamic import to pull in the map from an npm package.json in JavaScript

Is there a way to set up path mapping for pure JavaScript imports? Currently, when we want to import npm packages in pure JS without using webpack, the syntax is different. Instead of just using import package from 'package-name', we have to use ...

What is the best way to position a <label> to the left of an <input> field?

Examining the HTML and CSS code below: * { box-sizing: border-box; } .field { overflow: auto; } .field label { float: left; width: 80px; } .field input { display: block; width: 100%; } <div class="field"> <label>Test< ...

Using an array as an argument for .map() results in an error

This is quite unusual. Currently, I am passing an array containing a single object to the Render method of a React component: let content = this.state.links.map(link => { // eslint-disable-line return ( <li key={link._id}> <a href ...

Exploring Next.js' dynamic routes with an alternative URL approach

Currently in the process of transitioning a React project to Next.js, I've encountered a minor issue with Dynamic Routing that doesn't seem to have any readily available solutions online. I have multiple information pages that utilize the same c ...

The AppBar is consuming space and obstructing other elements on the

As I dive into React/Material-UI and learn the ropes of CSS, I've come across a challenge with my simple page layout featuring an AppBar. Unfortunately, this AppBar is overlapping the elements that should be positioned below it. In my quest for a sol ...