title: Angular: Get the index of the dropdown item
body: <p>I have the following in my view</p>
  
  <pre><code>&lt;div&gt;
      &lt;select ng-model="obj.arr[otherObj.variable]" ng-change="otherObj.variable=SOMETHING"&gt;
          &lt;option ng-repeat="label in obj.arrs"&gt;{{label}}&lt;/option&gt;
      &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Without the <code>ng-change</code> attribute, this code does what I want when <code>otherObj.variable</code> is one of the indexes of the obj.arr - it selects the correct item in the list.  </p>
  
  <p>What I want in addition to this is to set <code>otherObj.variable</code> to the index of the array item that is picked when the dropdown variable is changed.  So, if the second value in the dropdown is picked then <code>otherObj.variable</code> should be set to 1.  I tried to do this with a </p>
  
  <pre><code>ng-change="otherObj.variable=SOMETHING"
  </code></pre>
  
  <p>Problem is., I don't know what that <code>SOMETHING</code> should be.  Am I doing this right?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>My requirements are</p>
  
  <ol>
  <li>Select the top option in the dropdown by default </li>
  <li>select the appropriate item in the array depending on the value of otherObj.variable (this gets set by some external code so if I come to the page with this value set then I want the correct option selected) </li>
  <li>Make sure otherObj.variable is updated if I change the value in the dropdown. </li>
  </ol>