title: Getting user input text with $watch in AngularJS not working on ng-if
body: <p>I have a cross platform app built using AngularJS, Monaca and OnsenUI.</p>
  
  <p>I have a login view that checks if the user has logged in before by querying a SQLite database. Based on whether there is data in the database, I display a welcome message to the user OR I display the login text field.</p>
  
  <p>I have a method that queries the SQLite database and this is working as intended. When a entry is found on the database I set a boolean value to display the welcome message - else the boolean displays the login text field. </p>
  
  <p>On my view I do the following;</p>
  
  <pre><code>&lt;!-- User not in DB  --&gt;
  &lt;div ng-if="showLoginUI"&gt;                    
      &lt;div class="input"&gt;
          &lt;input type="password" placeholder="User ID" ng-model="userID"/&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I watch for changes in the text field to save the user input, but no actions are registered in the example as above. This is my method to register user action on the text field.</p>
  
  <pre><code>$scope.$watch("userID", function (newVal, oldVal)
  {
      if (newVal !== oldVal) {
          $scope.newUserID = newVal; // Not getting here
      }
  });
  </code></pre>
  
  <p>However, when I remove the ng-if from the example above - the user events are registered. How do I keep my ng-if while still registering events on the text-filed?</p>
  
  <p>I tried adding a $timeout to my $watch function but this did not help either.</p>