title: How to prevent value change inside $watch
body: <p>I'm $watching a scope value that can be edited by the user in an input field.
  I want to make sure that newValue is always a number and if it isn't, keep the oldValue until user types in a correct number value.</p>
  
  <p>How can I do that?</p>
  
  <p>What I'm currently doing is this (inside the link function of a directive):</p>
  
  <pre><code>scope.$watch('count',function(newValue,oldValue)
  {
      newValue=parseInt(newValue,10);
      if(isNaN(newValue))
      {
          newValue=oldValue;
      }
  });
  </code></pre>
  
  <p>Is that the proper way of doing that, or is there a better way?</p>
  
  <p>Thanks.</p>