title: How to validate mobile number for countries in angular?
body: <p>Here I validate mobile number using below code for universally for all countries using below code using this regex (<code>/^(\+\d{1,3}[- ]?)?\d{10}$/</code>) I doing but it not accept this type numbers (<code>(+91)9876543210</code> OR <code>09876543210</code>)</p>
  
  <p>This type of mobile Numbers accept</p>
  
  <pre><code>+91 9876543210 (or all other country code)
  
  (+91) 9876543210
  
  (+91)9876543210
  
  +919876543210
  
  +91-9876543210
  
  (+91)-9876543210
  
  9876543210
  
  09876543210
  </code></pre>
  
  <p>not accept numbers like</p>
  
  <pre><code>++91 9876543210(double ++),
  
  +91  9876543210(double spaces),
  
  +91 987 65   7 4 688(not more than one space),
  
  +91 808-75-74-678(not more than one -),
  
  +91-846363,
  
  80873(number less than 10 digit),
  
  8087339090456(number greater than 10 digit),
  
  0000000000(all zeros),
  
  +91 0000000(all zeros with country code)
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;mat-form-field&gt;
    &lt;input matInput placeholder="Enter contact No." [(ngModel)]="userObj.contactno" name="contactNo" required&gt;
  &lt;/mat-form-field&gt;
  &lt;button mat-button color="primary" (click)="saveNewCustomerDetails()"&gt;SAVE&lt;/button&gt;
  </code></pre>
  
  <p>TS</p>
  
  <pre><code>   saveNewCustomerDetails(){
       if(this.userObj.contactno.match(/^(\+\d{1,3}[- ]?)?\d{10}$/)){
          console.log("valid mobile number");
       }else{
          console.log("Invalid mobile number");
       }
     }
  </code></pre>