title: Angular: Issue in adding dynamically generated input field data on the (change) event
body: <p>I have a feature where I need to send dynamically generated input fields on button click.</p>
  
  <p>I have recreated the problem on <a href="https://stackblitz.com/edit/angular-dynamic-fields" rel="nofollow noreferrer">stackblitz</a> for better understanding.</p>
  
  <p>In that app, when I enter resourceQuantity, the resourceId fields are dynamically generated. 
  My issue is to identify those fields individually and send them on server side on single button click. </p>
  
  <p><a href="https://stackblitz.com/edit/angular-dynamic-form-fields" rel="nofollow noreferrer">This</a> solution I've found on stackblitz is similar, but in my problem I am not removing or adding on button clicks, but (change) event instead. </p>
  
  <p>Here is the <strong>HTML</strong> code: </p>
  
  <pre><code>&lt;mat-form-field&gt;
      &lt;input  matInput type="number" formControlName="resourceQuantity" [(ngModel)]="resourceQuantity" placeholder="Enter Resource Quantity" (change)="somethingChanged()"/&gt; 
  &lt;/mat-form-field&gt;&lt;br/&gt;&lt;br/&gt;
  &lt;div&gt;
      &lt;ul&gt;
          &lt;li *ngFor="let item of counter(resourceQuantity)"&gt;
              &lt;input  matInput type="number" placeholder="Enter Resource Number" formControlName="resourceId"/&gt; 
          &lt;/li&gt;       
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And here is the <strong>TS</strong> code:</p>
  
  <pre><code>  ngOnInit() {
      this.form = new FormGroup({
              'employeeId': new FormControl(null, {validators: [Validators.required]}),
              'employeeName': new FormControl(null, {validators: [Validators.required]}),
              'resourceQuantity': new FormControl(null, {validators: [Validators.required]}),
              'resourceId': new FormControl(null, {validators: [Validators.required]})
      });
    }
  
    somethingChanged() {
        console.log(this.resourceQuantity);
    }
  
    counter(i: number) {
        return new Array(i);
    }
  </code></pre>
  
  <p>Kindly let me know the best solution to my problem. Thanks.</p>