title: Why is this form validation with dynamic input values not working?
body: <p><em>Just started practicing angular...</em>
  I have made a reactive form (in parent component) in angular whose values are dynamically filled by child component.
  On submitting this form null values are saved since form is not detecting the values although values are visible in input fields.</p>
  
  <p>Note: input values are showing in parent component (child to parent communication is successful)</p>
  
  <p>Here is the necessary code: </p>
  
  <p><strong>Child component- ts file</strong></p>
  
  <pre><code>@Output() messageToEmit = new EventEmitter&lt;string&gt;();
  @Output() messageToEmit1 = new EventEmitter&lt;string&gt;();
  @Output() messageToEmit2 = new EventEmitter&lt;string&gt;();
  @Output() messageToEmit3 = new EventEmitter&lt;string&gt;();
  
  save(selectedItem: any, index: number)
  {
  var num1 = selectedItem.f;
  var num2 = selectedItem.l;
  var num3 = selectedItem.e;
  var num4 = selectedItem.p;
  
  this.messageToEmit.emit(num1);
  this.messageToEmit1.emit(num2);
  this.messageToEmit2.emit(num3);
  this.messageToEmit3.emit(num4);
   }
  </code></pre>
  
  <p><strong>Child component- html file</strong></p>
  
  <pre><code>  &lt;table class="w3-table-all"&gt;
  &lt;thead&gt;
    &lt;tr class="w3-red"&gt;
      &lt;th&gt;First Name&lt;/th&gt;
      &lt;th&gt;Last Name&lt;/th&gt;
      &lt;th&gt;Email&lt;/th&gt;
      &lt;th&gt;Password&lt;/th&gt;
       &lt;th&gt;Edit / Update&lt;/th&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
  &lt;tr *ngFor="let thing of things; let i = index;"&gt;   
    &lt;td&gt;&lt;input type="text" value="{{thing.f}}" id="{{ 'f' + i }}"&gt; &lt;/td&gt;
    &lt;td&gt;&lt;input type="text" value="{{thing.l}}"  id="{{ 'l' + i }}"&gt; &lt;/td&gt;
    &lt;td&gt;&lt;input type="text" value="{{thing.e}}"  id="{{ 'u' + i }}"&gt; &lt;/td&gt;
    &lt;td&gt;&lt;input type="text" value="{{thing.p}}"  id="{{ 'p' + i }}"&gt; &lt;/td&gt;
    &lt;td &gt;
      &lt;button (click) = "save(thing,i)"&gt;Edit&lt;/button&gt;
      &lt;/td&gt;
    &lt;/tr&gt; 
    &lt;/table&gt;
  </code></pre>
  
  <p><strong>Parent component - ts file</strong></p>
  
  <pre><code>export class ParentComponent implements OnInit {
  edited_values: string;
  edited_values1: string;
  edited_values2: string;
  edited_values3: string;
  edited_values4:  number;
  
  name = 'Registration';
  signupForm:FormGroup;
  FirstName:string = "";
  LastName:string = "";
  Email:string = "";
  Password:string = "";
  
  constructor(
  private frmbuilder: FormBuilder,
  )
  {
  this.signupForm= frmbuilder.group({
  fname:new FormControl('', [
  Validators.required,
  Validators.maxLength(50),
  Validators.minLength(3),
  Validators.pattern('^[a-zA-Z ]*$')
  ]),
  lname:new FormControl('', [
  Validators.required,
  Validators.maxLength(50),
  Validators.minLength(3),
  Validators.pattern('^[a-zA-Z ]*$')
  ]),
   email:['',[Validators.required,Validators.email]],
  userpassword:new FormControl('', [
  Validators.required,
  Validators.maxLength(50)
  ])
  });
  } 
  ngOnInit(){
  }
  
  postdata(signupForm:any)
  {
  this.FirstName=signupForm.controls.fname.value;
  this.LastName=signupForm.controls.lname.value;
  this.Email=signupForm.controls.email.value;
  this.Password=signupForm.controls.userpassword.value;
  
  this.signupForm.reset();
  }
  
  getMessage(message: string) {
  this.edited_values = message;
  }
  getMessage1(message1: string) {
  this.edited_values1 = message1;
  }
  getMessage2(message2: string) {
  this.edited_values2 = message2;
  }
  getMessage3(message3: string) {
  this.edited_values3 = message3;
   }
  reset(){
  this.signupForm.reset();
  }
  }
  </code></pre>
  
  <p><strong>Parent component- html file</strong></p>
  
  <pre><code>&lt;form id="contact" [formGroup]='signupForm' (ngSubmit)="postdata(signupForm)"&gt;
  &lt;h3&gt; Register Now! &lt;/h3&gt;  
  &lt;div class = "form-group"&gt;
    &lt;input type="text" formControlName='fname' placeholder="your First name" value={{edited_values}}&gt;
  &lt;/div&gt;
  &lt;div *ngIf="signupForm.controls.fname.invalid &amp;&amp; signupForm.controls.fname.touched"&gt;
  &lt;small&gt; Enter name please (only letters)!  &lt;/small&gt;
  &lt;/div&gt;
  &lt;br&gt;
  &lt;div class = "form-group"&gt; 
  &lt;input type="text" formControlName='lname' placeholder="your Last name"
  value={{edited_values1}}&gt;
  &lt;/div&gt;
  &lt;div *ngIf="signupForm.controls.lname.invalid &amp;&amp; signupForm.controls.lname.touched"&gt;
  &lt;small&gt; Enter name please (only letters)!  &lt;/small&gt;
  &lt;/div&gt;
  &lt;br&gt;
  &lt;div class = "form-group"&gt;
  &lt;input type="text" formControlName='email' placeholder="your Email id"
  value={{edited_values2}}&gt;
  &lt;/div&gt;
  &lt;div *ngIf="signupForm.controls.email.invalid &amp;&amp; signupForm.controls.email.touched"&gt;
  &lt;small&gt;  Email is invalid  &lt;/small&gt;
  &lt;/div&gt;
  &lt;br&gt;
  &lt;div class = "form-group"&gt;
  &lt;input type="Password" formControlName='userpassword' placeholder="your password"
  value={{edited_values3}}&gt;
  &lt;/div&gt;
  &lt;div *ngIf="signupForm.controls.userpassword.invalid &amp;&amp; signupForm.controls.userpassword.touched"&gt;
  &lt;small&gt; Must enter password in correct format: min 8 characters, at least 1 uppercase, 1 lowercase, 
  1 number, 1 special:  &lt;/small&gt;
  &lt;/div&gt;
    &lt;br&gt;
      &lt;div&gt;      
     &lt;button type="submit" &gt; Submit &lt;/button&gt;
     &lt;button type="reset" (click) = "reset()"&gt; Reset &lt;/button&gt;
   &lt;/div&gt;
   &lt;/form&gt;
   &lt;/div&gt;
   &lt;app-edit 
   (messageToEmit)="getMessage($event)"
   (messageToEmit1)="getMessage1($event)"
   (messageToEmit2)="getMessage2($event)"
   (messageToEmit3)="getMessage3($event)"
   (messageToEmit4)="getMessage4($event)" 
   &gt;&lt;/app-edit&gt;
  </code></pre>