title: Populating select with JSON in AngularJS with ng-options
body: <p>EDIT: My code actually does work, I was just being an idiot with an unrelated problem. Thanks for your input everyone.</p>
  
  <p>So I have an array of JSON objects formatted like this:</p>
  
  <pre><code>[{"id":"id1", "text":"text1"}, {"id":"id2", "text":"text2"},....]
  </code></pre>
  
  <p>I want to populate an AngularJS select field using these, with the text fields as the display text and the id fields as the values, or whatever binds to the model. I have looked around, but can't for the life of me figure out what I need to do.</p>
  
  <p>Right now I have this for my select, which results in nothing displaying:</p>
  
  <pre><code>&lt;select name="field" ng-model="npe.formData.field" ng-options="field.id as field.text for field in fields"&gt;
  </code></pre>
  
  <p>Doing ng-options this way results in things displaying, but obviously will result in the incorrect value binding to the model:</p>
  
  <pre><code>ng-options="field as field.text for field in fields"
  </code></pre>
  
  <p>I have seen people talking about using "(key, value)", but I can't wrap my head around how it works.</p>