title: Angular - Check if value entered into a field is a number
body: <p>In my Angular app I have a field that accepts either an email address or a phone number.</p>
  
  <p>If a number is entered I want to show a particular span. However I can't seem to get this working.</p>
  
  <p>So in my controller I have written:</p>
  
  <pre><code>$scope.isNumber = function (n) {
       return !isNaN(parseFloat(n)) &amp;&amp; isFinite(n);
  }
  </code></pre>
  
  <p>Then in my HTML I have:</p>
  
  <pre><code>&lt;form name="registrationForm"&gt;
  
  &lt;div&gt;
     Email or Mobile
     &lt;span ng-show="isNumber(registrationForm.usernameReg)"&gt;Include the country code.&lt;/span&gt;
  &lt;/div&gt;
  
  &lt;input name="usernameReg" ng-change="main.change()" type="text" ng-model="main.username"&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>Any ideas why this wouldn't work?</p>
  
  <p>Thanks.</p>