title: Html5 input using Angular empty value 0
body: <p>If I have an input such as below. What is the cleanest way I can ensure the empty string (input) is always 0.00.</p>
  
  <p>I was thinking it could be done with a watch but was wondering if there would be an easier way built into angular or html5 to handle it.</p>
  
  <pre><code>&lt;input class="form-control" type="number" step="0.01" placeholder="$" 
                                             data-ng-model="status.approved.price" /&gt;
  </code></pre>
  
  <p>Edit: What I actually needed was blur which handles clicking out of input as well as tabbing out. Tomek Sułkowski helped me get to this solution as you can see in this directive. Once the user leaves the input it will default to 0 if there is no value.</p>
  
  <pre><code>return {
      restrict: 'A',
      require: 'ngModel',
      link: function (scope, elem, attrs, ngModelCtrl) {
          elem.on('blur', function() {
              if (!elem.val()) {
                  elem.val('0');
                  ngModelCtrl.$setViewValue('0');
              }
          });
      }
  };
  </code></pre>