title: Why is my ng-model variable undefined in controller?
body: <p>I'm having trouble with $scope in my angular js project. When I use ng-model="modelExample" on an input field for example, I can't access it in my js using $scope.modelExample. Has anyone else had a similar problem?</p>
  
  <p>It's bizarre, a function is called but ng-model doesn't bind.  See my code below, the function refreshResults() is called when I submit the form but $scope.search returns as undefined.</p>
  
  <pre><code>angular.module('starter', 
      ['ionic', 
      'starter.controllers', 
      'starter.filters', 
      'akoenig.deckgrid', 
      "angucomplete",
      // 'ui.bootstrap', 
      'starter.services'])
  
  .config(function($stateProvider, $urlRouterProvider) {
      $stateProvider
          .state('app', {
              url: "/app",
              abstract: true,
              templateUrl: "templates/menu.html",
              controller: 'AppCtrl'
          })
  
          .state('app.browse', {
              url: "/browse",
              views: {
                  'menuContent' :{
                      templateUrl: "templates/browse.html",
                      controller: 'BrowseCtrl'
                  }
              }
          })
  
          .state('app.search', {
              url: "/search",
              views: {
                  'menuContent' :{
                      templateUrl: "templates/search.html",
                      controller: 'SearchCtrl'
                  }
              }
          })
    // if none of the above states are matched, use this as the fallback
    $urlRouterProvider.otherwise('/app/browse');
  });
  
  
  angular.module('starter.controllers', [])
  .controller('SearchCtrl', function($scope) {
      $scope.refreshResults = function() {
          console.log($scope.search);
      };
  })
  
  
  &lt;ion-view&gt;
      &lt;ion-content class="has-header"&gt;
          &lt;form ng-submit="refreshResults()" class="bar bar-header item-input-inset"&gt;
              &lt;label class="item-input-wrapper"&gt;
                  &lt;i class="icon ion-ios7-search placeholder-icon"&gt;&lt;/i&gt;
                  &lt;input type="search" placeholder="Search..." ng-model="search"&gt;
              &lt;/label&gt;
          &lt;/form&gt;
      &lt;/ion-content&gt;
  &lt;/ion-view&gt; 
  </code></pre>