title: angular 7 input number validation
body: <p>In angularjs:</p>
  
  <pre><code>&lt;form name="f" novalidate&gt;
  &lt;input type="number" ng-model="x" name="x"&gt;
  &lt;/form&gt;
  
  &lt;div ng-if="f.x.$error.number"&gt;NaN&lt;/div&gt;
  </code></pre>
  
  <p>Can I get same in Angular?</p>
  
  <p>E.g. <code>&lt;input type="number"&gt;</code> is valid in Angular7 is input is 'eee'.</p>
  
  <p><code>&lt;input type="number" required&gt;</code> is invalid if input is 'eee', but also invalid for ''.</p>
  
  <p><b>Edit</b></p>
  
  <p>As far as I see if I try to add some validator - it receives empty value in case of 'non-numeric' value.</p>
  
  <p><b>Edit 2</b></p>
  
  <p>Prolly will use workaround like this:</p>
  
  <pre><code>nativeNumber(element: ElementRef):ValidatorFn {
          return () =&gt; {
              return element.nativeElement.validity.valid ? null : {'number': true};
          }
      }
  </code></pre>