title: how to access ng-model in nested controller in angularjs
body: <p>I'm working with a parent controller and several children (in parallel).</p>
  
  <p><strong>router</strong></p>
  
  <pre><code>$stateProvider
    .state('page', {
      url: '/page1',
      templateUrl: 'templates/page.html',
      controller: 'pageCtrl'
  })
  </code></pre>
  
  <p><strong>page.html</strong></p>
  
  <pre><code>&lt;label class="item item-input"&gt;
      &lt;span class="input-label"&gt;Pedido&lt;/span&gt;
      &lt;input type="number" ng-model="pedido"&gt;
  &lt;/label&gt;
  
  &lt;div class="item item-input" ng-controller="matriculaCtrl as vm"&gt;
      &lt;label class="item-input-wrapper"&gt;
        &lt;span class="input-label"&gt;Matricula&lt;/span&gt;
        &lt;input type="text" placeholder="" ng-model="vm.matricula"&gt;
      &lt;/label&gt;
      &lt;button class="button button-small button-positive" ng-click="vm.scan()"&gt;
        &lt;i class="icon ion-qr-scanner"&gt;&lt;/i&gt;
      &lt;/button&gt;
  &lt;/div&gt;
  
  &lt;!--more controllers--&gt;
  
  &lt;button 
    class="button button-block button-positive icon-right ion-chevron-right"
    ng-click="send(pedido, vm.matricula)"&gt;
      Enviar 
  &lt;/button&gt;  
  </code></pre>
  
  <p><strong>controller</strong></p>
  
  <pre><code>.controller('pageCtrl', ['$scope', '$stateParams', 'CustomerService', function ($scope, $stateParams, CustomerService) {
    $scope.send = function(pedido, matricula){
          console.log(pedido+'-'+matricula);
    }
  }])
  
  .controller('matriculaCtrl', function ($scope, $rootScope, $cordovaBarcodeScanner, $ionicPlatform) {
      var vm = this;
  
      vm.scan = function () {
          $ionicPlatform.ready(function () {
              $cordovaBarcodeScanner
                  .scan()
                  .then(function (result) {
                      vm.matricula = result.text;
                  }, function (error) {
                      vm.matricula = 'Error: ' + error;
                  });
          });
      };
      vm.matricula = '';
  })
  </code></pre>
  
  <p>In the send function of the button, the first model works fine, but I can not access the second model, it always returns me undefined. Is there another way to do this?</p>
  
  <p>thanks in advance</p>