Using ng-if within ng-repeat in an AngularJs table structure

Hey there, I'm currently trying to utilize ng-if within ng-repeat. My condition is if {{dev[2]}} == "". If this condition is met, I want to display <td>Non Valide</td>; otherwise, I simply want to display the data inside 'dev'. I've searched for examples but haven't found anything fitting my specific case, as I am attempting to use if-else logic. Is it even possible to achieve this? Here's the code snippet I'm working with:

<table  class="table table-bordered"   >
        <thead><tr class="infoti" >
        <th>Id Dev</th>
        <th>Nom Dev </th>
        <th>Nom Ecu</th>
        <th>Etat</th>
        <th>Action</th>
        <tr>
        </thead>
        <tbody>     
<tr dir-paginate=" dev in devs | itemsPerPage:7 ">
            <td >{{dev[0]}}</td>
            <td>{{dev[1]}}</td>
            <td>{{dev[2]}}</td>
            <td ng-if({{dev[2]}} != "") >non validé</td>

<td><button class="btn btn-gray" ng-click="displaydata(dev[0])"  data-toggle="modal" data-target="#myModal" >Validé</button></td>
</tr>
        </tbody>
        </table> 

Any assistance would be greatly appreciated.

Answer №1

To implement conditional data binding in your view, consider using the ng-bind directive.

<td ng-bind="dev[2] != ''? 'Not Approved': 'Approved'"></td>

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

Is it possible to integrate the Firestore npm library into my Express application?

Recently, I created my own library to act as a nosql database on my node.js web server in place of mongodb. I came across this interesting quote: Applications that use Google's Server SDKs should not be used in end-user environments, such as on pho ...

I am receiving a reference error even though the day variable has already been defined. Can you kindly point out

When I attempt to log in, the page is giving me the correct output. Interestingly, even after encountering an error, the webpage continues to function properly. app.get("/", function(req, res) { let day = date.getDate(); console.log(day); r ...

Restangular: Avoiding empty parameter being passed

In my AngularJS application using RestAngular, I have the following controller method: $scope.findFriend = function (name, type, limit) { return FriendSearch.getList({ name: name, type: type, limit: limit ...

What is the best way to keep track of dynamically inserted input fields?

I've created a form with two text boxes: one for entering people's "name" and another for their "surname." By clicking on the page, you can add additional pairs of text boxes for both "name" and "surname," allowing users to input as many pairs as ...

Identify if a process operates synchronously or asynchronously

Can you identify in node.js, with the help of a function, if a method is synchronous or asynchronous? I am interested in creating a function that achieves the following: function isSynchronous(methodName) { //check if the method is synchronous, then ...

Instructions on activating the standard scrolling function for a specific DIV element

I'm struggling to achieve a specific scrolling effect on my one-page website. I want the initial section to be displayed as a full page, and when the user scrolls down, it should transition to the next section with a full page scroll. However, once th ...

I am curious to know how I can utilize Node.js to sum up values from a specific column within a CSV file

I recently started working with node.js and I'm currently working on a side project that I'm having some trouble with. My goal is to extract values from a specific column in an unzipped csv file and then add them up using node.js. Below is my co ...

Header cannot be set once they have already been sent

I'm having trouble setting the header in the code snippet below. Even though I've added a return at the end of each line, the res.json(data) seems to be executing twice. Can someone please correct me if I'm mistaken? Here is the content of ...

Mastering the art of horizontal scrolling within an angular material layout=row

I am attempting to create a slider using only a horizontal scrollbar with cards inside. In order to do this, I am trying to scroll the layout="row" within an ng-repeat. Check out my codepen here <body ng-app="myApp" ng-cloak ng-controller="ProductCont ...

locating the truth value of the data in an array retrieved from MongoDB

When returning from the mongoose find() function, I need to ensure that is_reqestor = true is checked. However, when updating the document, I pass the id which needs to be updated. let filter = { is_reqestor: true } if (!is ...

Help with enabling the recognition of backspace key in JavaScript?

My current JavaScript is almost perfect but missing one key element. The form has two fields that are disabled when the user fills it out. <label>Can you drive? </label> <input type="booleam" id="drive" disabled><br> <label>W ...

Two interactive dropdown menus featuring custom data attributes, each influencing the options available in the other

Looking to create interactive select boxes based on the data attribute values? This is the code I currently have: HTML <select id="hours" onchange="giveSelection()"> <option value="somethingA" data-option="1">optionA</option> <o ...

Issues observed when integrating Axios custom instance with Next.js

Initially, I created a custom axios instance with a baseURL and exported it as shown below: import axios from 'axios'; const instance = axios.create({ baseURL: process.env.BACKEND_URL, }); instance.defaults.headers.common['Authorization& ...

Convert the color hex codes to JSON format without the use of quotation marks

Currently, I am populating a JavaScript array named "data" with values. This array contains two elements: value and color, formatted like this: var data = [{value:226,color:"#FFFFF"},{value:257,color:"#FFFFF"}]; The issue is that the color should be repr ...

combination of Vue methods from a separate file

Having some trouble sharing a method in Vue across files. Despite trying various suggestions found through research, I haven't been able to make it work. I did manage to get mixins working within the same file, but couldn't figure out how to impo ...

What benefits can be gained from utilizing the beforeEach function within Jest testing?

I am currently immersing myself in the world of Jest by following this informative guide. Can you explain the benefits of utilizing the beforeEach function in Jest? I have a particular interest in identifying action dispatches. I believe that two segments ...

Filtering data in Vue.js using JSON specifications

How can I display only the names in the data? I currently have cards filtered by cities <div v-for="item in stationCityData"> <div v-for="option in filteredCity" style="background:#eee;padding: 20px"> <!-- <div v-for="option ...

Make sure to include both the :value and v-model attributes when using a radio input field

<input type="radio" :value="myValue" v-model="value" /> I am attempting to create a radio button within a component, where value is a variable. However, I am encountering an error that states: :value="myValue" conflicts with v-model on the same ele ...

Searching for partial nodes

I came across a helpful tutorial that explains how to perform a partial search. My goal is to have it so that when someone enters the text geor, it can locate a user named george. db.stores.find({storeName : {$regex : /Geor/}}).pretty() However, I am str ...

Launching a React project using the terminal - my step-by-step process

I'm attempting to initiate a new react-app utilizing the command npx create-react-app <app name> as shown below: npx create-react-app new-app However, after downloading, it seems to be stuck. It's not progressing at all. I've even rei ...