satya chowdary satya chowdary - 1 year ago 119
AngularJS Question

implementation of ng-options

i want to show A abd B as my options list from the below

"A": {
"status": 3,
"event": "Door was opened",
"name": "xxxxxx ",
"latlng": "xxxxx"

"B": {
"status": 4,
"event": "kitchen was opened",
"name": "xxxxx ",
"latlng": "xxxxx"

iam trying like this

<select ng-change="selected(prop)" style="color:black;" ng-model="prop" ng-options="item as item for item in devices">
<option value="">-- choose an option --</option>

Answer Source

You can have like this,

<label for="reason">Device</label>
   <select ng-change="selected(Device)" ng-model="Device" ng-options="key as key for (key , value) in devices"></select>


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download