title: How to access ng-model value in controller of popup model in angular?
body: <p>I want to access an ngModel from within a controller, but here the ngModel is defines in a popup input field.  I want to access the qty and name values in controller. Note that this whole code is model popup.</p>
  
  <h3>Model code</h3>
  
  <pre><code>&lt;ion-modal-view&gt; 
      &lt;ion-header-bar&gt;
          &lt;h1 class="title"&gt;Item Details&lt;/h1&gt;
      &lt;/ion-header-bar&gt;
      &lt;ion-content padding="true"&gt;
          &lt;form ng-submit="addItem()"&gt;
              &lt;div class="list list-inset"&gt;
                  &lt;label class="item item-input"&gt;
                      &lt;span class="input-label"&gt;Name&lt;/span&gt;
                      &lt;input type="text" name="name" ng-model="name"&gt;
                  &lt;/label&gt;
                  &lt;label class="item item-input"&gt;
                      &lt;span class="input-label"&gt;Qty&lt;/span&gt;
                      &lt;input type="number" name="qty" ng-model="qty"&gt;
                  &lt;/label&gt;
                  &lt;div class="padding item text-center"&gt;
                      &lt;button class="button button-dark"&gt;Add To Cart&lt;/button&gt;
                      &lt;a class="button  button-assertive" ng-click="closeModal()"&gt;Cancel&lt;/a&gt;            
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/ion-content&gt;
  &lt;/ion-modal-view&gt;
  </code></pre>
  
  <h3>Controller code</h3>
  
  <pre><code>.controller('GuestDetailsCtrl', function($scope){
      $scope.addItem = function() {
          alert($scope.name);
          alert($scope.qty);
      }; 
  });
  </code></pre>