Resetting the select value through your controller/services in AngularJS

I am having a tough time figuring out why my select values will not reset once I load in new data to my template.

In my template, I have this code for the select:

<select ng-model="mySelect" ng-change="showSelectValue(mySelect)">
    <option ng-repeat="item in selectOptions" value="{{item.value}}" ng-selected="{{item.value}}">{{item.title}}</option>   
</select>

I set the values for select through my controller using this:

$scope.selectOptions = [
      {value: "EndTimeSoonest", title: "Ending Soonest"},
      {value: "StartTimeNewest", title: "Recently Added"},
      {value: "PricePlusShippingHighest", title: "Highest Priced"},
      {value: "PricePlusShippingLowest", title: "Lowest Priced"},
      {value: "Completed", title: "Completed - Most Recent"},
      {value: "CurrentPriceHighest", title: "Completed - Highest Price"}
  ];

After new data is loaded, the select value stays on the previously selected value. I am trying to get it to reset to the first item and nothing seems to work. I have tried both of these:

$rootScope.mySelect = $scope.selectOptions[0].value;

And

$rootScope.mySelect = 'EndTimeSoonest';

You can see the current version of the web app here: http://dev.sortsof.com to test it out yourself.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.