title: How to set default option for select in angularjs
body: <p>Now I am trying to set a default value for a select dropdown. but couldn't get it down, code:</p>
  
  <pre><code>&lt;div class='paymentmethods subcontent' ng-switch on="editpaymentmethod"&gt;{{editselection.selectedmethod=Memethods[paymethodindex]}}// This gives me what I need,but select doesn't. confused?
              &lt;select ng-model='editselection.selectedmethod' ng-init="editselection.selectedmethod=Memethods[paymethodindex]" id='methods' ng-switch-when='Y'&gt;
                &lt;option ng-repeat="method in Memethods" value="{{method}}"&gt;{{method}}&lt;/option&gt;            
              &lt;/select&gt;
              &lt;select ng-model='editselection.selectedmethod' ng-init="editselection.selectedmethod=companies[paymethodindex]" ng-switch-when='N' style='float:left'&gt;
                &lt;option ng-repeat='companyoption in companies' value="{{companyoption}}"&gt;{{companyoption}}&lt;/option&gt;
              &lt;/select&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>$scope.paymethodindex = $scope.Memethods.indexOf(paymethod);
              console.log($scope.paymethodindex);
              if(reimbursement=='N')
                              {
              $scope.paymethodindex = $scope.companies.indexOf(paymethod);            
                              }
  </code></pre>
  
  <p>I use paymethodindex to set default value for select dropdown. I can even print out in the page with {{editselection.selectedmethod=Memethods[paymethodindex]}}, I think the index part works fine, any idea? </p>