title: AngularJS textbox returns undefined value
body: <p>When I press my button check in bootstrap modal, I want to print the value of my textbox in my console. But my textbox returns a undefined. It seems that all of the code are working perfect.</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html ng-app="app" ng-controller="ModalDemoCtrl"&gt;
  &lt;head&gt;
  &lt;link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"&gt;
  &lt;script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.js"&gt;&lt;/script&gt;
  &lt;script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.js"&gt;&lt;/script&gt;
  &lt;script src="example1.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div &gt;&lt;button class="btn btn-default" ng-click="open('lg')" &gt;Large modal&lt;/button&gt;
  &lt;script type="text/ng-template" id="myModalContent"&gt;
  &lt;div class="modal-header"&gt;
      &lt;h3 class="modal-title"&gt;I'm a modal!&lt;/h3&gt;
  &lt;/div&gt;
  &lt;input type="text" ng-model="new1" /&gt;&lt;button ng-click="check()" &gt;check&lt;/button&gt;
  &lt;div class="modal-footer"&gt;
      &lt;button class="btn btn-primary" ng-click="ok()"&gt;OK&lt;/button&gt;
      &lt;button class="btn btn-warning" ng-click="cancel()"&gt;Cancel&lt;/button&gt;
  &lt;/div&gt;
  &lt;/script&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is my javascript</p>
  
  <pre><code>var app = angular.module('app', ['ui.bootstrap']);
  //var ModalDemoCtrl = function ($scope, $modal, $log) {
  app.controller('ModalDemoCtrl',['$scope', '$modal','$log','$rootScope',
  function controller($scope, $modal, $log, $rootScope)
  {
      $scope.open = function (size) {
          $scope.val = "";
          var modalInstance = $modal.open({
              templateUrl: 'myModalContent',
              controller: ModalInstanceCtrl,
              size: size,
              backdrop: 'static',
              resolve: {
                  items: function () {
                      return $scope.items;
                  }
              }
          });
  
          modalInstance.result.then(function (selectedItem) {
              $scope.selected = selectedItem;
          }, function () {
              $log.info('Modal dismissed at: ' + new Date());
          });
      };
  }]);
  
  
  var ModalInstanceCtrl = function ($scope,$rootScope, $modalInstance) {
  
  $scope.check = function()
  {
      console.log($scope.new1);
  };
  
  $scope.ok = function () {
      $modalInstance.close();
  };
  
  $scope.cancel = function () {
      $modalInstance.dismiss('cancel');
  };
  };
  </code></pre>