Using ... I tried setting $scope.animalSelection.name = 'great dane' but it didn't work. – Andrew Samuelsen Sep 11 '13 at 18:45

  • @jessegavin I can however get it to work if I do $scope.animalSelection = animals[1]. This is not ideal... – Andrew Samuelsen Sep 11 '13 at 18:51
  • @Andypandy I would very strongly recommend that you use a library like underscore.js which gives you easy methods for dealing with collections. For example, you could use `_.findWhere(animals, { name: "great dane"})` instead of `animals[1]`. http://underscorejs.org/#findWhere – jessegavin Sep 11 '13 at 19:34
  • @jessegavin awesome thakns – Andrew Samuelsen Sep 11 '13 at 20:54
  • This is really good, but I would have appreciated if it would have render infinite nesting. – Kishor Pawar Feb 18 '17 at 08:54
  • 1

    An alternative without needing to flatten your data would be to use nested ng-repeat directives as in this post.

    Eric Drechsel
    • 2,694
    • 2
    • 23
    • 24
    0
    <div ng-repeat="people in People">
    <label>{{people.firstName}}</label>
    <select>
    <option ng-repeat-start="choice in people.Choices" ng-bind="choice.Name"></option>
    <option ng-repeat-end ng-repeat="opt in choice.Options" ng-bind="' - ' + opt.Name"></option>
    </select>
    </div>
    

    http://plnkr.co/edit/2vj4PK?p=preview

    user730009
    • 313
    • 1
    • 5
    • 18