title: Setting default value in select drop-down using Angularjs
body: <p>I have an object as below. I have to display this as a drop-down:</p>
  
  <pre><code>var list = [{id:4,name:"abc"},{id:600,name:"def"},{id:200,name:"xyz"}]
  </code></pre>
  
  <p>In my controller I have a variable that carries a value. This value decided which of the above three items in the array will be selected by default in the drop-down:</p>
  
  <pre><code> $scope.object.setDefault = 600;
  </code></pre>
  
  <p>When I create a drop-down form item as below:</p>
  
  <pre><code>&lt;select ng-model="object.setDefault" ng-options="r.name for r in list"&gt;                 
  </code></pre>
  
  <p>I face two problems:</p>
  
  <ol>
  <li><p>the list is generated as</p>
  
  <pre><code>&lt;option value="0"&gt;abc&lt;/option&gt;
  &lt;option value="1"&gt;def&lt;/option&gt;
  &lt;option value="2"&gt;xyz&lt;/option&gt;
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>&lt;option value="4"&gt;abc&lt;/option&gt;
  &lt;option value="600"&gt;def&lt;/option&gt;
  &lt;option value="200"&gt;xyz&lt;/option&gt;
  </code></pre></li>
  <li><p>No option gets selected by default even though i have <code>ng-model="object.setDefault"</code></p></li>
  </ol>