<!DOCTYPE html>
<html ng-app="optionsApp">

  <head>
    <script data-require="angular.js@1.6.2" data-semver="1.6.2" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.2/angular.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body ng-controller="OptionsCtrl">
    <h1>Hello Plunker!</h1>
    <form name="editForm">
      <select ng-options="item.name for item in items track by item.id" size="6" ng-model="currentItem"></select><br>
      Edit value: <input ng-disabled="!currentItem" ng-model="currentItem.val">
    </form>
    <ol>
      <li ng-repeat="item in items">{{item.name}}: {{item.val}}</li>
    </ol>
  </body>

</html>
// Code goes here

angular.module('optionsApp', [])
  .controller('OptionsCtrl', function ($scope) {
    $scope.items = [{
      id: 0,
      name: 'A Thing',
      val: null
    },{
      id: 1,
      name: 'Another Thing',
      val: null
    },{
      id: 2,
      name: 'A Shiny Thing',
      val: null
    },{
      id: 3,
      name: 'The Best Thing',
      val: null
    },{
      id: 4,
      name: 'The Worst Thing',
      val: null
    }];
  });
/* Styles go here */

# Undocumented `track by` Behavior in ngOptions

ngOptions in Angular.js gives coders a great way to quickly access data from a
select list. Unfortunately, doing much more than that requires more work, as
the use of the `track by` clause in the comprehension expression causes it to
create copies of items.

This functionality breaks a use case seen in this Plunker - you can select items
from the list and view their associated data, but changes cannot be written back
to the source without having to write your own lookup algorithm to find the item
you want to modify.

As of Angular 1.6, [lines 399-403 of ngOptions say that this is to prevent this exact use case](https://github.com/angular/angular.js/blob/v1.6.x/src/ng/directive/ngOptions.js#L399-L403),
but I don't see why this should be done? If the concern is that the user may
change the identifier used by the `track by` clause, then that's poor
application design and the application developer should have good reason to
allow that.