Customize AngularJS dropdown options using a constant value for filtering

How do I display drop-down options based on the Json object below where IsDeleted == 0

"currencies":[{
    "CurrencyID":"1",
    "CurrencyCode":"AED",
    "CurrencyName":"United Arab Emirates Dirham",
    "IsDeleted":"1"
},{
    "CurrencyID":"2",
    "CurrencyCode":"AFN",
    "CurrencyName":"Afghan Afghani",
    "IsDeleted":"1"
},{
    "CurrencyID":"3",
    "CurrencyCode":"ALL",
    "CurrencyName":"Albanian Lek",
    "IsDeleted":"1"
}];


<select ng-model="data.CurrencyID" ng-options="cu.CurrencyID as cu.CurrencyName for cu in currencies | filter : IsDeleted :'0'"></select>

Answer №1

<select ng-model="data.CurrencyID" ng-options="cu.CurrencyID as cu.CurrencyName for cu in currencies |filter : {IsDeleted :'0'}"></select>

Answer №2

When IsDeleted equals '0', substitute the " : " with the "=" operator after isDeleted

<select ng-model="data.CurrencyID" ng-options="cu.CurrencyID as cu.CurrencyName for cu in currencies | filter : IsDeleted = '0'"></select>

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

Ways to include scrolling specifically for one template

As a newcomer to frontend development, I have recently started learning Vue and the Quasar Framework. I am currently working on a table and trying to set a fixed table name with only the table items scrollable. <template> <q-table virt ...

Is there a way to set the starting position of the overflow scroll to the middle?

Is there a way to have the overflow-x scrollbar scroll position start in the middle rather than on the left side? Currently, it always begins at the left side. Here is what it looks like now: https://i.stack.imgur.com/NN5Ty.png If anyone knows of a soluti ...

Utilize React Hook Form to easily reset the value of an MUI Select component

I created a dropdown menu where users can select from "Item 1", "Item 2", and "Item 3". Additionally, there is a "Reset" button that allows users to clear their selection and make a new one. Below is the code I used: import React from ...

Tips for retrieving next-auth authOptions from an asynchronous function

I need to retrieve values from AWS Secrets Manager and integrate them into the authOptions configuration for next-auth. The code implementation I have is as follows: export const buildAuthOptions = async () => { const secrets: AuthSecrets = await getS ...

The repeated execution of a Switch Statement

Once again, I find myself facing a puzzling problem... Despite making progress in my game, revisiting one aspect reveals a quirk. There's a check to verify if the player possesses potions, and if so, attempts to use it involves calculating whether the ...

Is there a way to identify when an image extends beyond the boundaries of the browser window and subsequently reposition it?

Currently, I am implementing a method found at this link to display popup images of my thumbnails. However, there is an issue when the thumbnail is positioned close to the edge of the screen and the original image is too large, causing it to be cut off by ...

What is the best way to eliminate spaces in $location.search()?

While using $location.search('event', data);, I've encountered an issue where the URL displays something like this: ?event=arsenal%20fc%20 I am looking to remove these spaces in order to get: arsenalfc ...

Leveraging PHP variables to determine the image location, implement an onclick function to cycle through the image gallery

I am facing an issue with a database query that is supposed to display multiple images. These images are stored in a PHP variable and shown one at a time using a JavaScript gallery with an onclick function to navigate through them. Unfortunately, the funct ...

Journeying through a grid in AngularJS

My current project involves displaying a table where users can click on specific cells to highlight them. Now, I want to take it a step further and enable navigation of the highlighted cells using arrow keys on the keyboard. For example, if the user press ...

"Pairing Angular's loader with RxJS combineLatest for seamless data

Hey there! Currently, I'm working on enhancing my Angular application by implementing a global loader feature. This loader should be displayed whenever data is being fetched from my API. To achieve this, I am utilizing ngrx actions such as fetchDataAc ...

Develop a fresh button using either JavaScript or PHP

I have designed a mini cart (drop down) on my WordPress site with different styles for when there are products and when empty. To enhance the design, I have utilized CSS pseudo elements before and after to add content dynamically. Is it possible to includ ...

Formik button starts off with enabled state at the beginning

My current setup involves using Formik validation to disable a button if the validation schema is not met, specifically for a phone number input where typing alphabets results in the button being disabled. However, I encountered an issue where initially, ...

Obtain HTML controls in the code-behind of an ASP.NET application

Is it possible to access HTML changes made with JavaScript in ASP.NET code behind? I came across some dhtml "drag and drop" code online (), but I'm struggling to access the updated controls in my code behind after moving items between lists. I attem ...

When the mouse hovers over the slider, the final image jumps into view

After successfully building an image slider that displays 2 partial images and 1 full image on hover, I encountered a bug when setting the last image to its full width by default. This caused a temporary gap in the slider as the other images were hovered o ...

Unable to access account: HTML Javascript login issue

Problem with Login Code As a newcomer to HTML, CSS, and almost unknown in Javascript, I sought help from others to create a login code. The code was working fine earlier, but now it's not functioning as expected. Despite checking everything, I can&ap ...

Change this npm script into a gulp task

I have a script in npm that I would like to convert into a gulp task. "scripts": { "lint": "eslint .", "start": "npm run build:sdk && node .", "posttest": "npm run lint && nsp check", "build:sdk": "./node_modules/.bin/lb- ...

Using Javascript and JQuery to create an alert that pops up upon loading the page is not effective

I am having trouble making an alert show up when my website loads. The Javascript code is functional when directly included in the HTML, but once I move it to a separate file named script.js and link it, nothing happens. Can someone please help me identify ...

Troubleshooting problem with Material-UI and Next.JS in Webpack

I have encountered an error while trying to add the code from this file: https://github.com/mui-org/material-ui/blob/master/examples/nextjs-with-styled-components-typescript/next.config.js When I include the next.config.js code provided below, I receive ...

Creating dynamic forms in Angular with partial dynamicity

I'm working on streamlining the process of creating forms using AngularJS. My end goal is to be able to simply write something like: <form> <field-div label="Name"> <field which="form.name"></field> </field-div> ...

Scrolling vertically using window.open functionality

I am trying to open a pop-up window using window.open. I would like the scrollbars to appear only if necessary. Unfortunately, in Safari, the scrollbars do not show up unless I include scrollbars=1 in the code. However, this also causes horizontal scrollb ...