title: AngularJS Directive Numeric Format Masking
body: <p>The directive I have created uses the function setFormatting to mask the text value in an input field.</p>
  
  <pre><code>scope.$watch(element, function() {
      modelCtrl.$setViewValue(setFormatting(element.val(), attrs.symbol));
      modelCtrl.$render();
  });
  
  element.bind('blur', function() {
      modelCtrl.$setViewValue(setFormatting(element.val(), attrs.symbol));
      modelCtrl.$render();
  });
  </code></pre>
  
  <p>The scope.$watch applies the mask when the content is loaded/applied the first time, the element.bind applies the mask for the other times.  The scope.$watch is storing the symbol (if there is one) as part of the ng-model variable.  The element.bind is not.  I thought $setViewValue() and $render() did not update the ng-model variable.  Where is the variable being updated?</p>
  
  <p>See attached fiddle: <a href="http://jsfiddle.net/PJ3M4/" rel="nofollow">http://jsfiddle.net/PJ3M4/</a>
  <br />Thanks.</p>