This is my form
When entering a question, I can add as many alternatives as you wish. In action would be the button to edit alternative.
I would like my array to have this format:
{
"Question": "Question test",
"cod" : "pw3"
"Value" : "10"
"Alternatives": [
{
"test": "test",
"test2": "test",
"test3": "test"
},
]
}
When you click the add button you can add several alternatives, do not have a limit number
This code is what makes the alternatives appear:
<table>
<thead><tr><th>Name</th><th>Action</th></tr>
</thead>
<tbody>
<tr *ngFor="let quiz of quizes">
<td>
<input name="alternativa" type="text" [(ngModel)]="quiz.pergunta" [disabled]="!quiz.isEditable"/>
</td>
<td>
<button (click)="quiz.isEditable=!quiz.isEditable" *ngIf="!quiz.isEditable">Edit</button>
<button *ngIf="quiz.isEditable" (click)="quiz.isEditable=!quiz.isEditable">Save</button>
</td>
</tr>
</tbody>
</table>
<div class="ui-g-2 ui-md-2 ui-lg-2 ui-fluid espacamento-baixo">
<p-button label="Salvar"></p-button>
</div>
How can I populate the array this way when I click Save to complete the question?
