title: How to sort object data source in ng-repeat in AngularJS?
body: <p>Suppose I have the following users:</p>
  
  <pre><code>$scope.users = {
    "2": {
      email: 'john@gmail.com',
      name: 'John'
    },
    "3": {
      email: 'elisa@gmail.com',
      name: 'Elisa'
    }
  }
  </code></pre>
  
  <p>I would like to create a <code>&lt;select&gt;</code> with the following options:</p>
  
  <pre><code>&lt;option value="3"&gt;Elisa&lt;/option&gt;
  &lt;option value="2"&gt;John&lt;/option&gt;
  </code></pre>
  
  <p>In other words, users should be sorted by name.</p>
  
  <p>I tried the following using the <a href="http://docs.angularjs.org/api/ng.directive:ngRepeat#Parameters" rel="noreferrer"><code>(key, value) in expression</code></a> syntax, but it doesn't work:</p>
  
  <pre><code>&lt;option ng-repeat="(user_id, user) in users | orderBy:'user.name'" 
          value="{{ user.id }}"&gt;
    {{ user.name }}
  &lt;/option&gt;
  </code></pre>
  
  <p><a href="http://plnkr.co/edit/u54UQsI9PZRvF5j2cm09?p=preview" rel="noreferrer">Live example here.</a></p>
  
  <p>What am I missing?</p>
  
  <p>Please do not suggest solutions with <code>ng-options</code> as I use <a href="http://angular-ui.github.com#directives-select2" rel="noreferrer"><code>ui-select2</code></a> which is incompatible with <code>ng-options</code>.</p>