0
I made a ngFor
to list elements select
HTML and I’m wanting to capture all the data selected by this select
... I did it this way:
app.component.html
<form [formGroup]="secondFormGroup">
<div *ngFor="let data of getSizeArray(dataHead); let i = index" class="example-box cursor-normal">
<select formControlName="objetoMapeado">
<option *ngFor="let d of displayedColumns" [ngValue]="d">
{{d}}
</option>
</select>
</div>
</form>
app.componentts.
public secondFormGroup: FormGroup;
public displayedColumns: string[] =
['Nota Fiscal','Fornecedor','Data da Compra','Valor da Compra','Numero de Parcela','Valor da Parcela','Tipo de Recebimento'];
constructor(private _formBuilder: FormBuilder) {}
ngOnInit() {
this.secondFormGroup = this._formBuilder.group({
objetoMapeado: ['', Validators.required]
});
}
The problem that when I make one console.log
it only displays the value of the first element and not of all elements select
HTML.
console.log(this.secondFormGroup.get('objetoMapeado').value);
I didn’t understand how the implementation would work
application.components.ts
– Ikaro Sales
Can’t bind to 'control' Since it isn’t a known Property of 'select'. <select [control]="formArray[i]">
– Ikaro Sales
then you have to make the map based on the array you’re doing for
– Eduardo Vargas
How would it look ? I don’t have mta Xp with Angular
– Ikaro Sales