title: Select by name and get the Id of the selected item with Angular
body: <p>I am working in an MVC project with HTML and angular. 
  I have a select list which get selected based on a name entered in an input box, but I am not able to get the id.</p>
  
  <p>This works but I don't get the Id of the selected item:</p>
  
  <pre><code>&lt;input type="text" ng-model="selectedCountry"&gt;
      &lt;select class="form-control" 
      ng-model="selectedCountry" 
      ng-options="country.name as country.name for country in countries"&gt;
  &lt;option value=""&gt;Select Country&lt;/option&gt;
  </code></pre>
  
  <p></p>
  
  <p>And this is not working, as I am not able to select by the name and get the id:</p>
  
  <pre><code>&lt;input type="text" ng-model="selectedCountry"&gt;
    &lt;select class="form-control" 
      ng-model="selectedCountry" 
      ng-options="country.id as country.name for country in countries"&gt;
  &lt;option value=""&gt;Select Country&lt;/option&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is the plunker: <a href="https://plnkr.co/edit/fPv3NURiNamS5KoF2vdN?p=preview" rel="nofollow noreferrer">Plunker</a> </p>
  
  <p>Thanks for the help!</p>