Angular 2 Custom Validator: check if the input value is an integer?
<p>In an Angular2 project I need to validate some inputs.
How to easily check if an input value is an integer? </p>

<p>I tried using  <code>Number(control.value)</code> which returns <code>0</code> for an empty field - not good.</p>

<p>or <code>parseInt(control.value,10)</code> which dis-considers spaces:</p>

<p>If i have something like: 1 space 0,24 = <code>1 ,024</code> it returns 1 - which passes the validator with no errors.</p>

<p>Lodash functions like: <code>_.isInteger(control.value)</code> or <code>_.isNumeric(control.value)</code> 
<code>// return false every time</code> -which is expected, because an input value is a string not a number. </p>

<p>Combining methods like this creates a messy function with many if/else statements, and even then, I'm not sure i get all the edge cases. I definitely need a more straight forward approach. Any ideas?</p>