FAQ Database Discussion Community


Angular ng-options for bounded select elements

angularjs,select,options,ng-options
I'm almost there but stuck on one little detail. I can't seem to get the "name" property of the selected Car Make's "Car Model" to actually show up on the select menu. At the moment, it seems to be showing the correct number of options, but the options are visibly...

Select not selecting when binding with ng-model and ng-options

javascript,angularjs,select,angular-ngmodel,ng-options
Here's my select: <select class="form-control" ng-options="assistanceType as assistanceType.name for assistanceType in assistanceTypes" ng-model="selectedRecord.assistanceType"></select> Here's what I'm using to load the Assistance Types: $scope.getAssistanceTypes = function () { $http.get('/api/assistanceType/getAll'). success(function (data, status, headers, config) { $scope.assistanceTypes = data; }). error(function (data, status, headers, config) { alert(data.ExceptionMessage); }); } Here's the result:...

ng-options not selecting last item in option array

angularjs,ng-options,angularjs-ng-options
I have a weird problem that I'm not able to reproduce on Plunker. When the first option 'user' is set in the model, the select displays it properly and it is set to 'user'. When I load another user with role:'admin', the select is set to blank option. In my...

AngularJS remove ng-options blank value

html,angularjs,ng-options
<select ng-model="form.priority" ng-options="priority.id as priority.value for priority in leadPriority"></select> It is showing blank option by default. How can remove it ?...

How to set the initial ng-model value for a

javascript,sql-server,angularjs,unicode,ng-options
Hello I've ran into an issue that is stumping me: So I have an ngOption that loops through and displays unicode symbols <select class="form-control symbolSelect" ng-model="input.loadSymbol" ng-options="d as d.TagShpUTF for d in loadSymbols" ng-change=""></select> Here is an example jsFiddle showing it working: http://jsfiddle.net/tjm9a6o2/ I set up the datasource to have...

Pre-select option form ng-options list

javascript,angularjs,drop-down-menu,ng-options
I'm trying to preselect a item in the list which is generated by ng-options directive. Could someone please tell me whats happening in the plunker? http://plnkr.co/edit/GTnR76HEnB5NxQRe484m?p=preview <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script> <script> function MyCntrl($scope) { $scope.prop = { "type": "select", "name": "Service", "values": [{ 'name': "Service 1" }, { 'name': "Service 2"...

Hide selected option in other list using ngOptions in AngularJS

javascript,arrays,angularjs,ng-options,angularjs-ng-options
Hoping someone can help with this challenge. I have 1 array of airports being used in two build separate dropdowns. <select data-ng-model="flightData.origin" data-ng-options="airport.code as airport.label for airport in flightData.airports" name="origin"></select> and <select data-ng-model="flightData.destination" data-ng-options="airport.code as airport.label for airport in flightData.airports" name="destination"></select> Both of these lists obviously have the same options....

Bootstrap3 + Angular with Select causes the drop down to cut off

angularjs,html5,twitter-bootstrap-3,html-select,ng-options
I am trying to use the HTML Select tag along with AngularJs using the ng-options directive to create a drop down options menu. On top of this I am using Bootstrap 3. I also have ui-bootstrap imported into the project. Everything works functionally but I have an odd issue where...

How do I set ng-option model to the value of an object?

javascript,angularjs,ng-options
I'm pulling in an array of objects as $scope.templates. I'd like to be able to set $scope.item.steps (my select model name) to the value of template.steps for the selected option in my ng-options array. Is there an easy way to do this without having add extra controller logic? <select class="form-control"...

AngularJS: ng-options “non-choice” is not the top

javascript,angularjs,ng-options
I made my select tag directive of the private use template html <div> <select ng-model="model" ng-options="item as item[labelName] for item in array"> <option ng-if="!!hasTop" value="">non choice</option> </select> </div> "array" is return value of $recource.query With "non choice" in the top, I want to have. ex Select +-"non choice" +-option a...

what is best practice for Angular drop down menu & ng-option

javascript,angularjs,drop-down-menu,ng-options
good day, i created a drop dow menu on AngularJS. but it return to me an object not an item {"deptName":"IT","id":"1"}. i need to return the id only to my table. is there any thing i need to change on ng-options="item.deptName for item in department.departments" see the sample: JS angular.module('firstApp',...

Cannot bind ngResource to ngOptions

angularjs,ng-options,ngresource
I have a select element, and I want it populated with the result of a call to a resource via ngResource. <select chosen="" required data-ng-model="coolStuffSelected" data-ng-options="stuff for stuff in coolStuff" class="chosen-select input-md"></select> In my Controller I have CoolStuffResource.query(function(result){ $scope.coolStuff = result; console.log(JSON.stringify($scope.coolStuff)); // prints ["foo","bar","gaz","waka"] }); I see the result...

How to define ng-options selected value and assign this to model?

javascript,angularjs,model,ng-options
I have a data like this which i compile to select options and inside it selected value defined as defaultValue: 1 content: [ { value: "Bireysel", key: "1", defaultValue: 0 }, { value: "Kurumsal", key: "2", defaultValue: 1 }, { value: "Bireysel & Kurumsal", key: "3", defaultValue: 0 } ]...

Object comparison in ng-options

angularjs,ng-options
I have a select that I populate using ng-options and ng-model. The problem I have is that initially, the model is a copy of the data within the ng-options so my initial state is a blank option rather than the correct state of ng-model. How can I make it so...

Bind ng-options to nested array within JSON object, within ng-repeat

json,angularjs,angularjs-ng-repeat,ng-repeat,ng-options
This is my first question, so please be gentle on me! I hope you can help. I am trying to define a select box (dropdown) within my HTML view using ng-repeat, so that I can create a select for each item in an array. I have successfully achieved this, but...