title: directive to convert decimal value to integer
body: <p>I am trying to create a directive to convert <code>numeric</code> value into <code>integer</code>.</p>
  
  <p>For example, I have input type number and when user types 1.1 this value should be converted back to 1. </p>
  
  <pre><code>app.directive('toInteger', function() {
      return {
          require: 'ngModel',
          link: function(scope, elem, attrs, ngModel) {
              ngModel.$parsers.push(function(value) {
                  var value = parseInt(value);
                  return value;
              });
          }
      };
  });
  </code></pre>
  
  <p>Where am I wrong?</p>
  
  <p><strong>Problem:</strong>
  If i enter <code>1.1</code> than directive converts it back <code>1</code>. However, it keeps on showing <code>1.1</code> on view (inside input field).</p>
  
  <p>I am using directive with my html as follow</p>
  
  <pre><code>&lt;input type="number" name="input" class="form-control" min="0" max="1000" data-ng-model="input" to-integer&gt;
  </code></pre>