Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

ng-options angularjs

Given this array of items on the $scope:

$scope.items = [{
  id: 1,
  label: 'aLabel',
  subItem: { name: 'aSubItem' }
}, {
  id: 2,
  label: 'bLabel',
  subItem: { name: 'bSubItem' }
}];

<select ng-options="item as item.label for item in items track by item.id" ng-model="selected"></select>
Source by docs.angularjs.org #
 
PREVIOUS NEXT
Tagged: #angularjs
ADD COMMENT
Topic
Name
2+8 =