Here I have phone numbers input field and I check this input field phoneNumber in if condition this phone number has only numbers or characters using regex, I check this regex using match but if condition gives error like match is not found, I want to check phoneNumber is only number in if condition how it is possible in angularjs ?
<div class="col-md-6">
<small>Phone Number</small>
<input type="text" name="phonenumber" placeholder="" ng-model="phoneNumber">
</div>
if($scope.phoneNumber.match(/^[0-9]*$/)) {
factories.error('This is valid phone number');
} else {
factories.error('Phone Number must be a number');
}