title: How to change a <select> value from controller using angularJS?
body: <p>I am having a select element with 1-10 options as:</p>
  
  <pre><code>&lt;select id="selVal" ng-model="product.quantity" ng-options="o as o for o in quantityValues" ng-change="updateDelta(product.quantity, {{product.quantity}}, product.selected_size.qty_avail)"&gt;&lt;/select&gt;
  </code></pre>
  
  <p>while on controller side looks like:</p>
  
  <pre><code>$scope.quantityValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  </code></pre>
  
  <p>prerequisite: initially product.quantity &lt; product.selected_size.qty_avail</p>
  
  <p>what i want to do that when I try to select other option such that if value corresponding this new option is greater than the available quantity than update and display last selected option i.e one where selected option value was less than available quantity:</p>
  
  <pre><code>$scope.updateDelta = function(currentSelectedVal, prevSelectedVal, selectedProductAvailQty) {
  
      if(product.quantity &gt; selectedProductAvailQty) {
  
      //than 
  
      #scope.product.quantity = prevSelectedVal;//still in product.quantity in view previous value is not displayed
  
      }
  }
  </code></pre>
  
  <p>example: if available_quantity=4; previous selected product quantity=2; current selected product quantity=8</p>
  
  <p>current o/p i am getting: still 8 is displayed in select html tag</p>
  
  <p>expected: display previous selected product quantity i.e. display 2</p>