2

How do you populate deeply nested objects from hal+json into ng-options?

Here is a plunker with example code: http://plnkr.co/edit/0dPLEj1O63NUVMVdnZeK?p=preview

kimli
  • 269
  • 1
  • 4
  • 20

3 Answers3

2

Please find the updated plunker

http://plnkr.co/edit/8kMauqPnKNmwXmZx97wN?p=preview

<select ng-model="shift" ng-options="item._embedded.shift.number for item in rows._embedded[0].alternate">
          </select>

Let me know if anything

Please see here for all the options

Community
  • 1
  • 1
madhured
  • 443
  • 2
  • 8
  • Thanks madhured! This really helped. Here is the final plunker: http://plnkr.co/edit/fC85cUk69lCErn34MC0a?p=preview – kimli Mar 05 '14 at 17:32
0

This means to show your option.name for instance "Egg Toss" to represent the entire option object it is in. When you select "Egg Toss", the object "Egg Toss" is in will be assigned to the model "shift"

<select ng-model="shift" ng-options="option as option.name for option in table._embedded.events"></select>
koolunix
  • 1,995
  • 16
  • 25
0

Here is sample code which you may find useful.

JS:

 $scope.Period = 'Please Select';
 $scope.Periods = new Array('Last Month', '3 Months', 'Please Select');

HTML:

 <select style="width: 80%;" ng-change="GetPerformanceResults()" ng-model="Period">
                        <option ng-repeat="period in Periods">{{period}}</option>
                    </select>
aamir sajjad
  • 3,019
  • 1
  • 27
  • 26