title: AngularJs: Can't set option as selected in select programatically
body: <p>I have a service that calls to pop up.
  The pop up is contains two drop-down lists.
  The user is asked to choose the two drop down lists and press ok to return to the service.</p>
  
  <p>In the next call to the pop up i would like that the pop up will display the previous options that was selected by the user. </p>
  
  <p>Everytime i returns to the pop up the drop down are full but no selection has happened and i can't figure out what i am missing.</p>
  
  <p>The service that calls to the pop up: </p>
  
  <pre><code>app.service('OriginalService', [ '$modal',
  
  function ($modal) {
      var that = this;
  
      this.filtersMananger = { // my-ng-models for the two drop-down-lists
          firstFilter: "",
          secondFilter: ""
      };
  
      this.openDialog = function(){
          var modalInstance = $modal.open({
              templateUrl: 'ModalScreen.html',
              controller: 'ModalController',
              resolve: {
                  filtersManagerObject: function () {
                      return that.filtersMananger;
                  }
              }
          });
  
          modalInstance.result.then(function (filtersMananger) {
              that.filtersMananger.firstFilter = filtersMananger.selectedFirstFilter;
              that.filtersMananger.secondFilter = filtersMananger.selectedSecondFilter;
          }, function () {
  
          });
      };
  }
  ]);
  </code></pre>
  
  <p>The pop up html:</p>
  
  <pre><code>&lt;div class="data-filters-container"&gt;
       &lt;div class="data-filter"&gt;
          &lt;label for="filter-data-drop-down"&gt;FIRST FILTER&lt;/label&gt;
          &lt;select name="filterDataDropDown" ng-model="filtersMananger.selectedFirstFilter" ng-options="filter.value as filter.name for filter in filterDropDownItems"&gt;&lt;/select&gt;
      &lt;/div&gt;
        &lt;div class="data-filter col-xs-4"&gt;
          &lt;label for="filter-data-drop-down"&gt;SECOND FILTER&lt;/label&gt;
          &lt;select name="filterDataDropDown" ng-model="filtersMananger.selectedSecondFilter" ng-options="filter.value as filter.name for filter in filterDropDownItems"&gt;&lt;/select&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The code :</p>
  
  <pre><code>app.controller('ModalController', ['$scope', '$modalInstance', 'filtersManagerObject',
                                       function ($scope, $modalInstance, filtersManagerObject) {
  
      $scope.filtersMananger = {
          selectedFirstFilter : "",
          selectedSecondFilter : ""
      };
  
      $scope.filterDropDownItems = [
  
          {name: "4h", value: "lastFourHours"},
          {name: "24h", value: "lastDay"},
          {name: "All", value: "all"}
      ];                                                                              
  
      /*
      * The function checks if the the values in filters are not "".
      * If there are not so we found the selected filter and returns it.
      */
      $scope.fillPreviousSelections = function(){
          if ($scope.isfiltersManagerObjectNotEmpty()){
              $scope.fillSelections();
          }
      };
  
      $scope.isfiltersManagerObjectNotEmpty = function(){
          return (filtersManagerObject.firstFilter !== "" || filtersManagerObject.secondFilter !== "");
      };
  
      $scope.fillSelections = function(){
          if (filtersManagerObject.firstFilter !== ""){
              $scope.findDropDownItem(filtersManagerObject.firstFilter);
          }
      };
  
      $scope.findDropDownItem = function(filterValue){
          var isFound = false;
          for (var i = 0; i &lt; $scope.filterDropDownItems.length &amp;&amp; !isFound; i++){
              var dropDownItem = $scope.filterDropDownItems[i];
              if (dropDownItem.value === filterValue){
                 //////////////////////////////////////////////////////////////
                 Maybe the problem is here:
                  $scope.filtersMananger.selectedOneFilter = dropDownItem;
  
                  /////////////////////////////////////////////////////////////
                  isFound = true;
              }
          }
      };
  
      $scope.fillPreviousSelections();
  
      $scope.ok = function () {
          $modalInstance.close($scope.filtersMananger);
      };
  
      $scope.cancel = function () {
          $modalInstance.dismiss('cancel');
      };
  }]);
  </code></pre>