'Angular Get dynamic created inputs values

I am creating some inputs based on the value of another input, my problem is I don't know how to get the value of these new inputs that are generated.

This is my View Part:

<div class="input-group">
    <div class="input-group-append">
        <button class="btn btn-secondary" (click)="minusInv()" type="button">
            <i class="fa fa-minus">
            </i>
        </button>
    </div>
        <input formControlName="inventario" [value]="quantityInv">
    <div class="input-group-append">
        <button class="btn btn-secondary" (click)="plusInv()" type="button">
            <i class="fa fa-plus">
            </i>
        </button>
    </div>
</div>

        <ng-container *ngFor="let values of valuesArr; let i= index">
                <div class="form-group" style="float:left; margin: 5px;">
                    <input 
                    placeholder="{{values}}.-" 
                    style="background-color: #e6e9ed;" class="form-control"
                    type="text">
                </div>
        </ng-container>        

And in my controller part, functions plusInv and minusInv fills the inventarioArr which is just a number array that determinates the number of inputs that will be generated, and I don't know how to get the values of these inputs.

Controller:

    plusInv()
    {
        this.quantityInv++;
        this.formGroup.controls['inventario'].patchValue(this.quantityInv)
        //this.formGroup.controls['ninos'].updateValueAndValidity();
    }
    minusInv()
    {
      if(this.quantityInv>1)
      {
      this.quantityInv--;

      }
      else
      {this.quantityInv}
      this.formGroup.controls['inventario'].patchValue(this.quantityInv)
    }

How can I get the value of my dynamic inputs?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source