FAQ Database Discussion Community


Can't access options for ng-options inside an ng-repeat

angularjs,angularjs-directive,angularjs-scope,angularjs-ng-repeat,angularjs-ng-options
I would like to be able to access a set of select options within an ng-options inside an ng-repeat, but the ng-repeat creates a new scope where I can no longer access this. Is there a way around this without adding it to the repeating data? <body ng-controller="mainCtrl" class="container"> <test...

Angular ng-model with ng-options

javascript,angularjs,angularjs-ng-options
Having trouble setting the default option in my ng-options/ng-model. My problem is that while the dropdown is getting populated with the correct options, the default option is blank. This leads me to believe there's something wrong with how I'm doing ng-model. Any help? I have a table I'm using ng-repeat...

angularjs select the first value in select box

javascript,angularjs,bootstrap,angular-ui-bootstrap,angularjs-ng-options
I need to highlight the first value 'fullName' in select box using angularjs. I am using angularstrap selectbox. controller, $scope.accountInfo.owners = [ { "accounts":null, "phoneumber":null, "email":null, "fullName":"MITA DASGUPTA", "mobilePhoneNumber":null, "noteFlag":false, "number":130000000484 } ] Template, <button type="button" class="btn btn-default" placeholder="Pleasae select" data-ng-model="owner.fullName" data-html="1" bs-options="owner as owner.fullName for owner in accountInfo.owners" bs-select>...

Angular ng-options mapping “select” portion to different model properties

angularjs,angularjs-ng-options
I'm trying to use ng-options to select a Role. I have Role objects that look like this: { Id: 'someRoleId', Name: 'someRoleName } and then a list of select options that come from the server like this: { Value: 'someRoleId' Text: 'someRoleName', } Currently I have this select field bound...

AngularJS ng-option get index

javascript,angularjs,ng-options,angularjs-ng-options
I'm making a playlist option in the project I'm working on and I'm trying to get a dropdown for all the videos in the list. which is easy <select ng-options="vid.Id for vid in playList.Videos track by video.Id" ng-model="selected" class="browser-default"></select> but this shows a drop down of the Id's, but now...

How to select and filter with multiple select boxes populated by ng-options over the same json object?

angularjs,filter,angularjs-scope,angularjs-ng-repeat,angularjs-ng-options
I'm attempting to display a list of data from a json object structured like so: [{ "behavior": "Any", "actions": [ {"category": "Web Actions", "hva": "Item4 Product Page", "value": 5.3}, {"category": "Web Actions", "hva": "Item Product Page", "value": -1.4}, {"category": "Web Actions", "hva": "Item3 Product Page", "value": 2.4}, {"category": "Web Actions",...

Angular.js ng-option select using keypress

javascript,angularjs,google-chrome,ng-options,angularjs-ng-options
I have a <select> populated via ng-options. In a specific case, when two values are adjacent in the ordered model list and the values have the same first letter, the updating of the model value in angular breaks. This may be a browser event issue but I'm not certain. This...

redirect on ng-change in select tag

javascript,angularjs,angularjs-scope,angularjs-ng-options
How do i pass the groupId in the below code <select ng-options="group.id as group.name for group in groups" ng-model="groupId" ng-controller="redirectCtrl" ng-change="go('group/list/{{groupId}}')"> ...

How to convert id as order number in ng-options group by..?

javascript,angularjs,angularjs-ng-options
This is my code Fiddle Link HTML <div ng-app ng-controller="MyCtrl"> <input type="text" ng-model = "data.name" ><br> <input type="text" ng-model = "data.value" ><br> <input type="text" ng-model = "data.id" ><br> <input type="button" value="ADD" ng-click = "addIntoArr(data.name, data.value, data.id)" ng-disabled= !data.name> <select ng-model="selectItem" ng-options="currOption as 'order' + (data.indexOf(currOption)+1) group by currOption.name for currOption...

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...

ng-options filter based on selected value

angularjs,angular-filters,angularjs-ng-options
I've to write a directive to edit labels for an app. Each culture (eg: en-US) can have maximum 4 labels per property which are contained into a table : $scope.suffixes = ["DisplayName", "Description", "Hint", "Help"]; <div class="clear" ng-repeat="label in labelModel | filter:cultureFilter"> <select ng-options="suffix as suffix for suffix in suffixes...

AngularJS ng-options

angularjs,angularjs-scope,ng-options,angularjs-ng-options
I have this select in AngularJS: <select id="objectId" name="seccionId" class="form-control" ng-model="arguments.seccion" data-ng-options="item.id as item.valor for item in arguments.objects" required></select> I like to save both values in scope, but I only save one value. Any form to save both values? Thanks!!!...

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....

AngularJS: Shows reference error : goToFormDashboard not defined in scope

angularjs,cordova,ionic-framework,angularjs-ng-options
I am trying to call a function on onchange event but getting reference error everytime for that function my fromtend code is this: <label class="item item-input item-select" ng-controller="manageTeam"> <div class="input-label"> Select Form </div> <select onchange="goToFormDashboard($(this).children(':selected').val())" ng-model="Formname" ng-options="f.Formname for f in forms track by f.Formid"></select> </label> My controller is this: .controller('manageTeam',...

ngOption default selected option

angularjs,angular-ngmodel,angular-services,angularjs-ng-options
How to have a default option in select box...I tried several options and do not get it I tried creating a scope on my contralador with the value of the object that comes from json: Like this: $scope.productSelect = $scope.item[0]; this my code: html: <select id="variant" class="form-control variant-select" ng-model="productSelect" ng-options="product...

How to sort array in ng-options by key?

javascript,angularjs,select,angularjs-filter,angularjs-ng-options
There is such array: month: Array[13]0: "M"1: "January"2: "February"3: "March"4: "April"5: "May"6: "June"7: "July"8: "August"9: "September"10: "October"11: "November"12: "December" I do: ng-options="key as value for (key, value) in data.month | orderBy:key" But I get unsorted select list. ...

angularjs ngModel not selecting option in select input

angularjs,angularjs-ng-model,angularjs-ng-options
Does ngModel working differently for input type text and select? The select control is not selected to reflect the initial model value. When I change the value of the select, input and currentUser.field change also, but if I change the value of input text to another key nothing happens to...

AngularJS ng-options from an object with objects

angularjs,object,ng-options,angularjs-ng-options
I am attempting to have my data show up in the list as follows: <option value="4351">Atlanta</option> Here is my object. $scope.cityList = { 4351:{name:"Atlanta", short="atlanta"}, 7355:{name:"Baltimore", short="baltimore"}, 1212:{name:"Chicago", short="chicago"}, 4398:{name:"Dallas", short="dallas"} }; HTML This worked with just key-value pairs, but now the "value" is an object <select class="select-city" ng-model="myCity" ng-options="name...

Applying ngClassEven and ngClassOdd like behavior to ngOptions

angularjs,angularjs-ng-options
I want to add Styling to ngOptions via ngClassEven and ngClassOdd. I know they are supposed to work with ngRepeat but in the mean time i could not switch to ngRepeat. I have seen this answer but it does not corresponds to my needs. Is it possible to apply a...

AngularJS doesn't update selected option

angularjs-scope,ng-options,angularjs-ng-options
I have the following problem. In my controller I have this variables: $scope.types = [ {id: 0, name: $translate.instant("FIRST")}, {id: 1, name: $translate.instant("SECOND")}, {id: 2, name: $translate.instant("THIRD")}, {id: 3, name: $translate.instant("FOURTH")} ]; $scope.itemtype = {}; $scope.itemtype = $scope.types[0]; In my view I have this select <select class="form-control" required ng-model="itemtype" ng-options="item...

How could I use ng-options in a Select on this object?

javascript,angularjs,angularjs-ng-options
I have an object called groupList that looks like this: { "12777e85-c03a-97ba-42ce-3242b6bd4109": { "id": "12777e85-c03a-97ba-42ce-3242b6bd4109", "name": "uber name for group" }, "57415d36-e935-cc6a-11b4-0b95bce5cb95": { "id": "57415d36-e935-cc6a-11b4-0b95bce5cb95", "name": "a group name" }, "65c9cf1d-0876-1faf-7986-e44bbba8d0fe": { "id": "65c9cf1d-0876-1faf-7986-e44bbba8d0fe", "name": "users" }, "d3525828-0b53-a7eb-6c17-ea142a54687e": { "id": "d3525828-0b53-a7eb-6c17-ea142a54687e", "name": "admin" } } And I'm trying to use...