Questions tagged [ng-options]
Related with AngularJS .HTML SELECT element with angular data-binding. Optionally ngOptions attribute can be used to dynamically generate a list of <option> elements for a <select> element using an array or an object obtained by evaluating the ngOptions expression.
928
questions
0
votes
0
answers
17
views
Magento2 catalog product grid
Create a custom colum in the product grid. It shows that how many size options available against that product. If the product has (S,M,L) then 3, if product has (XS,S,M,L,XL) then 5 and if product has ...
0
votes
0
answers
62
views
how to handle ng-select can't populate data properly when an option that is already selected will be deleted from the list
in here want to delete an option that is already used in ng-select, but after saving the form, data can populate but it can't be translated.
How to handle value ng-select to populate value that is ...
0
votes
0
answers
21
views
Why does option tag in select is not working after migrating from Angularjs 1.3 to 1.8 version?
I have been working on AngularJs 1.3 and the below code is working fine in 1.3 version but after migrating the Angularjs version to 1.8.2, the below code is not working as expected.
<select ...
0
votes
1
answer
25
views
Access the whole item in ng-options in AngularJS
Not sure how else to title this. I'm using ng-options to generate a drop down. The source array is of the following form:
[{
id:1,
name: 'Bob'
},
{
id:2,
name: 'Tom'
}...(etc)
]
my ...
1
vote
1
answer
761
views
Extra white space in dropdown with VirtualScroll true in ng-select angular component
Extra space is showing in ng-select dropdown when I use virtuallScroll property as true.
Reproducible example
https://stackblitz.com/edit/angular-uuvic8?file=styles.css
1
vote
0
answers
33
views
AngularJS translate pip directive applied to ng-options for loop in dropdown menu
I am using a dropdown menu in AngularJS and I need to translate its items.
<div class="col-sm-3" style="top: 10px;">
<label>{{'...
0
votes
2
answers
3k
views
How to remove(display : none) disabled options in ng-options of ng-select?
I don't want to display value which have property enabled set to false in the dropdown.
<ng-select placeholder="Select" *ngIf="test.test.type == 'test1'">
<ng-...
0
votes
1
answer
180
views
What are the Angular ways to generate <option> elements that requires value and text dynamically from data for <select>?
I want to generate an option list using angular expression to achieve
<select id="sel">
<option value="1">value1</option>
<option value="2"&...
0
votes
1
answer
127
views
Classes on <option>:s using ng-options
I have a <select> which I populate with weeks from an ajax call.
Some of the items should be red (setting a class where reddays > 0).
I prefer to not use ng-repeat to output the options, ...
0
votes
0
answers
79
views
AngularJS ng-options from nested array
Is it possible to use nested for-loops in an ng-options expression?
The following python-style syntax does not work in AngularJS v1.5.8:
ng-options="user for group in userGroups for user in group....
-1
votes
1
answer
69
views
Pre-set option in select box with customized text in Angular JS
I want to pre set my select box by using whole object available in my array. the text will be customized by using object fields as shown in below image
this is what I have tried so far
<html>
&...
1
vote
0
answers
15
views
All Undefined Results
Please tell me if this select statement looks wrong to you. For some reason, every selection in the drop-down reads undefined instead of the username.
View
<select class="form-control" ng-model="...
1
vote
0
answers
11
views
how do I select ng-option select angularjs?
When edit the product, I want this ng-option to be selected automatically. How do I do that?
<div ng-if="field.name=='ProductId'" class="input-group inputFill">
<select ng-disabled="...
1
vote
1
answer
513
views
ng-options with multiple conditions
I have a select that has a filter set to not show the 'public' string in an array (public, publicExtra and private) if a specific condition is met in the ng-if. But now I discovered that that is not ...
0
votes
1
answer
527
views
ng-options filter with condition
I have a select with ng-options + filter and need to apply a condition to the filter itself. So if a specific condition is met then apply the filter otherwise don't. Thanks in advance.
# example
if (...
1
vote
1
answer
293
views
exclude value with in ng-options
I've been trying to figure out how to exclude a value from an array generated by ng-options using filters with no luck.
The array generated by the snippet below generates the following array ["...
0
votes
1
answer
451
views
Angular: Select box with array of objects
I am very, very new to Angular... and I've been trying to solve a problem for the last two days. But either my google-fu is weak or my brain is getting too dumb to understand due to force feeding it ...
0
votes
1
answer
198
views
Angular - *ngFor on nested JSON
I am trying to create a mat-option with a nested mat-option structure base on a JSON object. I've tried to create a *ngFor together with a pipe to run through the structure of the JSON. So when ...
1
vote
1
answer
356
views
AngularJS select element selects question mark value, ngmodel related
For some reason my ng-model is not valid against select options compiled by AngularJS. This is common problem but I did not find a solution that works here.
The select is inside tr element repeated by ...
0
votes
1
answer
2k
views
color of option in Angular select
How do I assign a font colour for each option in the dropdown menu in angular?
I tried to do it by adding
ng-style="{color:{{selectedCar.dropdown_color}};}" to the select tag, but it's not working.
...
0
votes
2
answers
50
views
My ng-option select bar is showing the last value in the list
Here is my HTML
<select ng-if="list[$index].length>0" data-ng-model="form1value[$index]"
data-ng-options="label for label in obj.child track by $index">
</select>
I am getting ...
0
votes
3
answers
179
views
Selecting `<option>` value from controller for `<select ng-options>`
<select
class="form-control input-md
availabiltyDatesInput pull-left"
name="statusModel"
autocomplete="off"
id="statusModel"
ng-options="alertStatus.value as ...
0
votes
2
answers
50
views
Finding ngOption selected within ngRepeat
I have a table which is populated with directive ngRepeat, and within each item is ngOptions. On change I call function transactionListFilter in the controller to find out which select has changed, so ...
0
votes
2
answers
211
views
ng-options is only working for name, not value
I've seen a few questions here similar to this. In fact that's how I got this far. But one little piece isn't working. I have the following:
<select id="facility" class="form-control"
ng-...
0
votes
1
answer
86
views
Angular ng-options ONLY works when ng-repeat operates on same model
I am working on an ASP.Net MVC page that uses a dropdown which currently uses the ng-repeat tag. I'm working to solve the problem where the dropdown does not correctly select the current model value ...
0
votes
1
answer
53
views
How to have a default selected value for angularjs 1.5 programmatically
I want to add a "Select a bank" option in the dropdown. I Only want that option to be selected if there is more than 1 item in the list (banks). This is the code:
This is what I current have:
<...
0
votes
1
answer
44
views
How can I apply filters on Table based on dropdown Value
I have one dropdown with values as
<select ng-model="recat" ng-options="r.Id as r.Name for r in Categories">
<option value="" disabled="" class="">-- Select Category --</option>...
0
votes
0
answers
47
views
AngularJS(1.6.6) ngOptions Filter is not working (not doing anything)
I am working in a small website, I am calling an array of items from a JSON file (this is working properly). But I want to give the user the option to see either All Items or Available Items or No ...
-2
votes
2
answers
311
views
Set filter value as options in select box
In Angularjs app, i am using ng-options to display the user and valid from date.
Here i am having a checkbox which will be checked default means only valid rates needs to be displayed..
Here valid ...
-2
votes
1
answer
86
views
Filter select options in angularjs
In my Angularjs application, i am having code as follows,
HTML:
<div ng-app="test" ng-controller="test">
<div>
<input type="checkbox" ng-model="showvalidrates"> Display ...
1
vote
2
answers
989
views
Select default option with ng-options using a flat array
I'm generating <option>'s with ng-options using a flat array. The problem I'm having is selecting the default option element I already have defined. Seems to be a very simple task and there's ...
0
votes
1
answer
41
views
Ng-options not displaying anything
I'm using this array on my controller:
var vm = this;
vm.documentGenerationEnum= [
{id:0, name: 'Manual'},
{id:1, name: 'Automatic'}
];
and I'm using this on the html
...
0
votes
1
answer
971
views
Is there a way to show previously selected option in a dropdown
I have a <select> element in my html page. The <option>s are given through a loop. The selected value is stored using a ng-model. This data is now push to a database. The next time that ...
0
votes
3
answers
508
views
ng-options orderBy value in key value pairs
I am not able to order a key value pair with respect to value in alphabetical order.
The sample which I am using is,
"week_days_short":[
{"key":"1","value":"Mon"},
{"key":"2","value":"Tue"},...
0
votes
1
answer
31
views
equating variables which are coming from http calls
I have a select tag with options populated by AngularJS. I am trying to select an option if it equals to another property in scope. Option values and scope property I am trying to compare are both ...
0
votes
1
answer
44
views
How can ng-options work wtihout a controller?
I have an array of strings ['One', 'Two', 'Three'] that I'd like to use as <option> tags in my Angular component. I don't want to use a controller. I just want to use ng-options. How does this ...
0
votes
0
answers
153
views
getting hidden values in drop down list
I am using drop down which should display list in my object using ng-option.
I am getting list of four items in drop down,I am not able to see items in drop down
<select class="" ng-model="vendor....
0
votes
1
answer
193
views
How to change value in a select with ng-options by code?
I'm working on a project with angularjs, in which I have three DDLs on a page (HTML), created by "select" using "ng-options", once I selected the three DDLs, when I selected the first DDL, I put in an ...
3
votes
1
answer
715
views
Writing custom directive to add tooltips to ng-options in AngularJS (TypeScript)
I have some HTML that is currently populating a select box using the ng-options directive. Our problem is that ng-options doesn't support using tooltips. To solve this, I am trying to write a custom ...
0
votes
2
answers
99
views
angular treats whitepace as null with ng-options
In controller, i have an array like this
'Pipe': '|',
'Comma': ',',
'Tab': '\t'
};
and in ng-options, im using it like this
<select
ng-model="csv.delimiter"
ng-options="...
0
votes
1
answer
260
views
ng-if showing both elements during asynchronous call [duplicate]
Using: v1.3.15
I understand what the coder was trying to accomplish by using two select menus for this. However, because the data being loaded in the select box is the result of an api call, there is ...
-1
votes
1
answer
118
views
Angular 1.6.1 ng--option values prefixed with type:
This problem is driving me crazy. I am trying to pre-select a value using ng-options as follows:
<select name="listing_type_id" ng-model="listing_type_id"
ng-options="i.id as i.name for i ...
0
votes
1
answer
81
views
Value in Select using ng-options is not populating
This is a basic query but for some reason failing and need help.
<select> is not populating the value when try to edit an entity. It should show value returned from db for this property but it ...
0
votes
2
answers
97
views
How can I bind a default value on dropdown select using Angular JS?
I have a form update on my page and I already implemented a binding value and I can show it on a plain text. My problem is how can I select this by default?
Here's my code:
<select
id="...
0
votes
1
answer
1k
views
ng-change is fired a second time when selected option is removed from ng-options - AngularJS 1.7
I have a list of sale items and for each sale item there is a dropdown box where you can select from a list of available IDs to assign to the sale item. The selection must be unique for each sale item....
0
votes
1
answer
928
views
How do I create a "select all" option from an ng-options dropdown that automatically selects all of the options?
I would like to populate my ng-options dropdown with an option that when selected, will select all possible options in the dropdown. Part of the problem is I do not how to programmatically select ...
0
votes
0
answers
34
views
angularjs ng options not jumping to option on letter press
I have a list of objects and using them for ng-options on a select element.
<select class="form-control"
ng-model="$ctrl.selectedTimeZone"
name="selectedTimeZone"
...
0
votes
1
answer
25
views
Angularjs select with group based on two tables
I have two arrays that stripped down looks like this:
USERS (username, companyid) and
COMPANIES (companyid, companyname)
I want to fill a select with users, grouped by company names, hopefully ...
1
vote
1
answer
138
views
AngularJS - Data Model Doesn't Bind in Dropdown
HTML:
<select class="form-control" name="paramType" ng-change="setParamC($index)" ng-model="row.ParameterT" ng-options="item.ReferenceValue for item in pagemodel.ParamTList" required></...
1
vote
1
answer
56
views
Changes to ng-options object not updating to html
When I select an item, the input elements update. However, after I save any changes, the element becomes unbound to the ng-model object. Sorry if this is a simple question, I searched for several ...