title: how to check input value has only numbers in angular?
body: <p>I want to compare a value of a field centerCode which is entered by a user into an input field. Then I want to check if it is a number and show the appropriate alert accordingly. I am not able to compare  the value or variable number with the variable code . </p>
  
  <pre><code> var numbers =/^[0-9]+$/;
   var code = $scope.Nuser.centerCode;
   alert(code);
   if(code.val(numbers))
   {
       alert(code.val(numbers));
   }
   else
   {
       alert("enter numbers only");
   }
  </code></pre>