title: Angularjs how to set the default value for select
body: <p>I have the following object:</p>
  
  <pre><code>defaults = {
  0 : {
      id : 10,
      value : "string 1"
      },
  1 : {
      id : 22,
      value : "string 2"
      }
  }
  </code></pre>
  
  <p>I want to iterate over this object and display it as a select box.</p>
  
  <pre><code>&lt;select ng-model="selectedValue" ng-options="obj.id as obj.value for obj in defaults"&gt;
     &lt;option value=""&gt;---Select option-----&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>What I'm trying to achieve is to select 'string 2' by default. But it does not work.
  The problem I have is the fact the selectedValue is a string:</p>
  
  <pre><code>$scope.selectedValue = "string 2";
  </code></pre>
  
  <p>From what I learned from the documentation the selectedValue must be the same object. But unfortunately, it is not possible. In my case selectedValue must be a string.
  In other words I need to operate with the name of the option only, I don't care about id.
  I tried to use ng-repeat. It even works but displays an empty option and I don't think using ng-repeat is a good way to do it.</p>
  
  <p>Any advice will be appreciated greatly.</p>