title: ng-options in angularjs does not get rebind after change in collection
body: <p>I am using dataFactory for getting collection by making api call.</p>
  
  <pre><code>    productApp.factory("productDataFactory", function($http){
    return {
      getUnits: function() {
        return $http.get('/unit').then(function(resp) {
          return resp.data; // success callback returns this
        });
      },
      getCommodities: function() {
        return $http.get('/commodity').then((resp) =&gt; {
          return resp.data;
        })
      }
    };
  
  });
  </code></pre>
  
  <p>I use commodities collection in ng-options to populate options of select element.</p>
  
  <pre><code>&lt;select ng-model='selected_Commodity' ng-change="updateGST()" name="commodity" id="commodity" ng-options = " c as c.commodity_name for c in &lt;%= JSON.stringify(commodities) %&gt; track by c "class="form-control  selectpicker" data-size="4" data-live-search="true" data-index="5" &gt;
                                &lt;option value="" ng-hide='selected_Commodity'&gt;Select Commodity&lt;/option&gt;
                                &lt;/select&gt;
  </code></pre>
  
  <p>I am updating collection on a event. I am getting updated values in log. But It does not get reflected in my view.</p>
  
  <pre><code>var getCommodities = function() {
      var deferred = $q.defer();
      productDataFactory.getCommodities().then((data) =&gt; {
        if (data.type === 'success') {
          debugger;
          console.log("Inside factory ");
          console.log(JSON.stringify(  data.commodities ));
          deferred.resolve(data.commodities);
  
        } else {
          // $scope.commodities = [{name : data.type + data.msg}]
          deferred.reject([{name : data.type + data.msg}]);
        }
  
      })
      return deferred.promise;
    }
  
  $('#commodityModal').on('hide.bs.modal', function () {
      $scope.commodities = []
      getCommodities().then((data) =&gt; {
        $scope.commodities = data
        console.log("Inside Hide ");
        console.log(JSON.stringify(  $scope.commodities ));
        $("#commodity").selectpicker('refresh')
        console.log("Refreshed");
      })
  
    })
  </code></pre>
  
  <p>Please help me how can I rebind my select elements with updated values.</p>