title: Regex for numbers only (no spaces or special chars) using ng-pattern
body: <p>I have an input field that should only be valid if it contains only digits and no special characters and no spaces.  I am using ng-pattern in angular to validate the input.</p>
  
  <p>I have tried using:</p>
  
  <pre><code>/^\d+$/
  
  /^\d*$/
  
  /^[0-9]+$/
  </code></pre>
  
  <p>These work to prevent special characters and letters, but do nothing about the spaces.  Does anyone know a regex that would consider spaces an invalid character?  I am trying to avoid preventing the input using keyCode.</p>
  
  <p>I apologize if there's already a thread for this.  I found many similar ones but nothing that helped with the spaces.</p>
  
  <p>EDIT:
  Even if the regex is supposed to prevent spaces normally, it is does not seem to be working with ng-pattern:</p>
  
  <pre><code>&lt;input type="tel" maxlength="10" ng-pattern="/^[0-9]+$/" placeholder="(1234567890)" /&gt;
  </code></pre>
  
  <p>Is still returning the <code>ng-valid-pattern</code> class on the input if I type a space.</p>