title: AngularJS $scope.variable not changing after modal bootstrap popup closes
body: <p>Why is <code>$scope.Templt_Kind_ID</code> not changing after the bootstrap popup is closed?
  Note: I do not close the popup until I retrieve the dropdown value from the popup.</p>
  
  <p>I call a bootstrap popup with edit controls.
  After a user changes a dropdown value, it calls
  the <code>$scope.onSelectChangeTemplate_kind = function ()</code>
  In the function below, </p>
  
  <pre><code>var ddlID = $scope.selectedCountry; contains the correct value.
  $scope.Templt_Kind_ID = ddlID;  // &lt;&lt; $scope.Templt_Kind_ID = 34 as it should be
  </code></pre>
  
  <p>Upon closing the popup, I expected <code>$scope.Templt_Kind_ID =  34</code>
  but it contains <code>-1</code> which is what it was first initialized to.</p>
  
  <p>Why? <code>$scope.Templt_Kind_ID</code> should =  <strong>34</strong></p>
  
  <p>JavaScript</p>
  
  <pre><code>app.controller('APIController',  function ($scope, $window, $element, $log, $http, APIService) {
      $scope.Templt_Kind_ID = -1; // &lt;&lt; Initial value
  
  // Bootstrap popup. After dropdown in bootstrap is changed, this is called.
  // I tried a number of things including $scope.onSelectChangeTemplate_kind = function ($scope) 
  $scope.onSelectChangeTemplate_kind = function () {
      var ddlID = $scope.selectedCountry; // &lt;&lt; contains correct value
      $scope.Templt_Kind_ID = ddlID;  // &lt;&lt; $scope.Templt_Kind_ID = 34 as it should be
  }
  
  // Bootstrap popup is closed.
  // Why is $scope.Templt_Kind_ID=-1 although it shuold be 34 ?????
  // Why is $scope.Templt_Kind_ID=-1 although it shuold be 34 ?????
  $scope.hide = function () {
          console.log('model one hidden Templt_Kind_ID=' + 
   $scope.Templt_Kind_ID); // &lt;&lt;&lt;&lt;&lt;&lt;
           // &lt;&lt; $scope.Templt_Kind_ID is still -1 although it shuold be 34 
          $scope.showModal1 = false;
  }
  }) 
  
  &lt;html&gt;
  &lt;modal-body&gt;
      &lt;div ng-controller="APIController"&gt;
          &lt;select id="ddlSelectedCountry" ng-model="selectedCountry"  ng-change="onSelectChangeTemplate_kind()"&gt;
              @*3-SP Insert*@
              &lt;option value=""&gt;Select Account&lt;/option&gt;
              &lt;option 
                      ng-model="selectedCountry"
                      ng-repeat="item in list_Template_kind" value="{{item.Templt_Kind_ID}}"
  
                      &gt;
                  {{item.Templt_Kind_ID}}-{{item.Templt_Kind_Name}}
              &lt;/option&gt;
          &lt;/select&gt;
      &lt;/div&gt;
  &lt;/modal-body&gt;
  &lt;/html&gt;
  </code></pre>