title: Angular UI Modal 2 Way Binding Not Working
body: <p>I am adding an Angular UI Modal where I am passing the scope through to the Modal Window for 2 way binding. I used the <code>resolve</code> method to pass the scope value. Doing so works sort of works meaning when the ng-model value changes in parent, it reflects inside the modal window. However, if the value changes inside the modal window, it is not reflecting in the parent ng-model. Here is my code:</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;div ng-app="app"&gt;
      &lt;div ng-controller="ParentController"&gt;
          &lt;br /&gt;
          &lt;input type="text" ng-model="textbox.sample" /&gt; 
          &lt;a class="btn btn-default" ng-click="open(textbox.sample)"&gt;Click Me&lt;/a&gt; 
  
          &lt;script type="text/ng-template" id="ModalContent.html"&gt;
              &lt;input type = "text" ng-model= "ngModel" / &gt;
          &lt;/script&gt;
  
  
          &lt;br /&gt;{{ textbox }}        
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>var app = angular.module('app', ['ui.bootstrap']);
  
  app.controller('ParentController', function ($scope, $modal) {
  
      $scope.textbox = {};
  
      // MODAL WINDOW
      $scope.open = function (_ngModel) { // The ngModel is passed from open() function in template   
          var modalInstance = $modal.open({
              templateUrl: 'ModalContent.html',
              controller: ModalInstanceCtrl, 
              resolve: {
                  ngModel: function () {
                      return _ngModel;
                  }
              } // end resolve
          });
      };
  });
  
  var ModalInstanceCtrl = function ($scope, $modalInstance, ngModel) {
      $scope.ngModel = ngModel;
  
  };
  </code></pre>
  
  <p><strong>Why isint the 2 way binding between parent and modal instance not working in the above code?</strong></p>