title: AngularJS $watch not working in if-block
body: <p>I figured out, that my angular script is working:</p>
  
  <pre class="lang-js prettyprint-override"><code>$scope.CurrentUser = null;
  $scope.DatePicker = new Date();
  $scope.$watch('DatePicker', function (newValue, oldValue) {
      if (newValue &gt; new Date())
          $scope.DatePicker = new Date();
  }, true);
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div&gt;
      &lt;input data-ng-model="DatePicker" type="date" id="datepicker" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  
  
  <p>but not if I add an if-statment:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div data-ng-if="!CurrentUser"&gt;
      &lt;input data-ng-model="DatePicker" type="date" id="datepicker" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>
  Try it:
  <a href="http://codepen.io/anon/pen/jWBEVM" rel="nofollow">http://codepen.io/anon/pen/jWBEVM</a></p>
  
  <p>But I don't understand why. Is there a known issue? Can anybody help?</p>