title: Facing Problem in validation of email and Phone number in Reactive form
body: <p>I am working on Angular Application where I am facing problem in validation of email and Phone number</p>
  <p>Problem</p>
  <ol>
  <li><p><strong>For email validation</strong> Problem when I put @ in wrong email and doesn't put .com or .in   example -: abcd@gm   .. it doesn't show error message,</p>
  </li>
  <li><p><strong>For Phone number validation</strong>, error message is only shown when Phone number is left blank, when we enter phone number and it exceed max length or for min length then it does not show any error message.</p>
  </li>
  </ol>
  <p><strong>component.ts</strong></p>
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { ServicesService } from '../service/services.service';
  import { FormGroup  , FormControl  , Validators } from '@angular/forms';
  @Component({
    selector: 'app-register',
    templateUrl: './register.component.html',
    styleUrls: ['./register.component.scss']
  })
  export class RegisterComponent implements OnInit {
  
   constructor( public restapi:ServicesService) {
  
      this.user = new FormGroup({
  
        email: new FormControl('', [Validators.required,Validators.email]),
        phone: new FormControl('', [Validators.required, Validators.minLength(10)]),
        password: new FormControl('', [Validators.required, Validators.minLength(6)])
        });
  
     }
  ngOnInit() {
  
  
    }
  }
  </code></pre>
  <p><strong>component.html</strong></p>
  <pre><code> &lt;form class=&quot;example-form&quot; novalidate (ngSubmit)='user_signup(user)'  [formGroup]='user'&gt;
            &lt;div class=&quot;row align-items-center&quot;&gt;
              &lt;div class=&quot;col-md-1&quot;&gt;
                &lt;label&gt;&lt;img src=&quot;assets/imgs/email-icon.svg&quot;/&gt;&lt;/label&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-11&quot;&gt;
                &lt;mat-form-field class=&quot;example-full-width&quot;&gt;
                  &lt;input matInput placeholder=&quot;Email&quot; name='email' formControlName='email' value=&quot;&quot; /&gt;
                &lt;/mat-form-field&gt;
                &lt;div style='color:#fff ;float: left ;font-size: 10px;' class=&quot;required&quot; no-lines item-end *ngIf=&quot;( user.get('email').hasError('required') || user.get('email').hasError('email') ) &amp;&amp; user.get('email').touched&quot;&gt;
                  &lt;span class=&quot;error&quot; *ngIf=&quot;user.get('email').hasError('required') &amp;&amp; user.get('email').touched&quot;&gt;
                    Email Required
                  &lt;/span&gt;
                  &lt;span class=&quot;error&quot; *ngIf=&quot;user.value.email &amp;&amp; user.get('email').hasError('email') &amp;&amp; user.get('email').touched&quot;&gt;
                    Invalid email!
                  &lt;/span&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;row align-items-center&quot;&gt;
              &lt;div class=&quot;col-md-1&quot;&gt;
                &lt;label&gt;&lt;img src=&quot;assets/imgs/mobile-icon.svg&quot;/&gt;&lt;/label&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-11&quot;&gt;
  
                &lt;mat-form-field class=&quot;example-full-width&quot; &gt;
                  &lt;input matInput type='number' placeholder=&quot;Phone Number:&quot;  name=&quot;phone&quot; formControlName=&quot;phone&quot; required/&gt;
  
                &lt;/mat-form-field&gt;
  
                &lt;div style='color: rgb(248, 226, 226) ; float:left ; font-size: 10px;' class=&quot;required&quot; item-end no-lines *ngIf=&quot;( user.get('phone').hasError('required') || user.get('phone').hasError('minlength') || user.get('phone').hasError('maxlength'))&amp;&amp; ( user.get('phone').touched)&quot;&gt;
  
                  &lt;span class=&quot;error&quot; *ngIf=&quot;user.get('phone').hasError('required') &amp;&amp; user.get('phone').touched&quot;&gt;
                      Phone number Required
                    &lt;/span&gt;
  
                    &lt;span class=&quot;error&quot; *ngIf=&quot;user.get('phone').hasError('maxlength') &amp;&amp; user.get('phone').touched&quot;&gt;
                      Min 10 digit
                    &lt;/span&gt;
  
                  &lt;/div&gt;
  
  
              &lt;/div&gt;
            &lt;/div&gt;
       
      &lt;!--Phone otp--&gt;
            &lt;div class=&quot;row align-items-center&quot;  &gt;
              &lt;div class=&quot;col-md-1&quot;&gt;
                &lt;label&gt;&lt;img src=&quot;assets/imgs/otp-icon.svg&quot;/&gt;&lt;/label&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-9&quot;&gt;
                &lt;mat-form-field class=&quot;example-full-width&quot;&gt;
                  &lt;input matInput placeholder=&quot;Verify phone otp:&quot; value=&quot;&quot; (input)='onInputTimePhone($event.target.value)' required/&gt;
                &lt;/mat-form-field&gt;
                &lt;div&gt;
                  &lt;span *ngIf='Otpvarification'&gt; Please enter Otp &lt;/span&gt;
                 &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-2&quot;&gt;
                &lt;a class=&quot;get_otp&quot; mdbBtn mdbWavesEffect (click)=&quot;phoneGetOtp(user.value.phone)&quot;&gt;Get otp&lt;/a&gt;
              &lt;/div&gt;
            &lt;/div&gt;
    &lt;!--Phone otp ends--&gt;
            &lt;div class=&quot;row align-items-center&quot;&gt;
              &lt;div class=&quot;col-md-1&quot;&gt;
                &lt;label&gt;&lt;img src=&quot;assets/imgs/password-icon.svg&quot;/&gt;&lt;/label&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-9&quot;&gt;
                &lt;mat-form-field class=&quot;example-full-width&quot;&gt;
                  &lt;input matInput type='{{type}}' placeholder=&quot;Password:&quot; name='password' formControlName='password' value=&quot;&quot;  /&gt;
                &lt;/mat-form-field&gt;
                &lt;div style='color: #fff ; float:left ; font-size: 10px;' class=&quot;required&quot; text-center no-lines *ngIf=&quot;( user.get('password').hasError('required') || user.get('password').hasError('minlength') || user.get('password').hasError('maxlength'))&amp;&amp; user.get('password').touched&quot;&gt;
                  &lt;span class=&quot;error&quot; *ngIf=&quot;user.get('password').hasError('required') &amp;&amp; user.get('password').touched&quot;&gt;
                    Password is required
                  &lt;/span&gt;
                  &lt;span class=&quot;error&quot; *ngIf=&quot;user.get('password').hasError('minlength') &amp;&amp; user.get('password').touched&quot;&gt;
                    Min 6 characters
                  &lt;/span&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class=&quot;col-md-2&quot;&gt;
                      &lt;a mdbWavesEffect *ngIf=&quot;!showPass&quot; (click)=&quot;showPassword()&quot;  class=&quot;showPassword&quot;&gt;
                          &lt;img src=&quot;assets/imgs/show.svg&quot; &gt;
                      &lt;/a&gt;
                      &lt;a mdbWavesEffect *ngIf=&quot;showPass&quot; (click)=&quot;showPassword()&quot; class=&quot;showPassword&quot;&gt;
                          &lt;img src=&quot;assets/imgs/hide.svg&quot; &gt;
                      &lt;/a&gt;
              &lt;/div&gt;
  
            &lt;/div&gt;
           
            &lt;button mdb mdbWavesEffect [disabled]=&quot;disabledAgreement&quot; class=&quot;register_btn&quot;&gt;Sign Up&lt;/button&gt;
          &lt;/form&gt;
  </code></pre>