I have a row with ngFor that iterates through an array and creates a row with 6 columns, which the first column receives a string from the array. The user can add rows inserting the row name in a text input and pressing a button, the problem is i need the row inside a Form, so i can get the form.value and use it to my database later and i need the first column to have the default value inserted by the user. How can i insert the value string from the ngFor array into the input?
<form #f="ngForm" (ngSubmit)="postDados(f)" >
<ion-row class="row header">
<ion-col class="col">Nervos</ion-col>
<ion-col class="col">Service Code</ion-col>
<ion-col class="col">Pay Limit</ion-col>
<ion-col class="col">Account Number to Use</ion-col>
<ion-col class="col">Account Number to Use</ion-col>
<ion-col class="col">Account Number to Use</ion-col>
</ion-row>
<ion-row class="row" *ngFor ="let nervo of nervos">
<ion-col class="col">
<ion-input type="text" name="nomeNervo" [(ngModel)]="nomeNervo"></ion-input>
</ion-col>
<ion-col class="col">{{nervo.nervoNome2}}</ion-col>
<ion-col class="col"></ion-col>
<ion-col class="col"></ion-col>
<ion-col class="col"></ion-col>
<ion-col class="col"></ion-col>
</ion-row>
</form>
<ion-row>
<ion-col col-6>
<ion-input type="text" [(ngModel)]="nomeNervoNovo" name="nomeNervoNovo"></ion-input>
</ion-col>
<ion-col col-6>
<button ion-button (click)="pushRow(nomeNervoNovo)" color="danger">
Inserir
</button>
</ion-col>
</ion-row>
this is the pushRow method
pushRow(nome: string){
this.nervos.push(nome);
console.log(this.nervos);
}
Any ideas? thanks anyway