#I am needing help to build a table in html.
7 messages · Page 1 of 1 (latest)
@unique orchid Please do not post pictures of code (especially photos of a physical screen) as they are difficult to read and difficult to correct (as you cannot copy code from a screenshot to modify it).
g!codeblock @unique orchid
@unique orchid, you can use the following snippet to have your code formatted and colored by Discord. Replace ts with the language you need (i.e. html, js, css, etc)
```ts
// your code goes here
```
<ng-container formArrayName="pasosArray">
<div [formGroupName]="pasoSeleccionado">
<tr *ngFor="let atributo of atributosPaso.controls; let i= index">
<td>
{{ i + 1}}
</td>
<!-- <div > -->
<tr>
<td>
<div class="form-group" [formGroupName]="i">
<input class="form-control" type="Valor"
placeholder="Valor"
formControlName="valor" required>
</div>
</td>
<td>
<div class="form-group" [formGroupName]="i">
<select class="form-control form-control-sm"
formControlName="tipoAtributoSeguimiento"
[compareWith]="compareWithTipoAtributo" *ngIf="recuperado" required>
<option
*ngFor="let tipoatr of listaTipoPasos"
[(ngValue)]="tipoatr">
{{tipoAtr}}
</option>
</select>
</div>
</td>
<!-- </div> -->
<td>
<div [formGroupName]="i">
<button (click)="removeAtributo(i)" class="btn
btn-default">
<i class="fa fa-remove"></i>
</button>
</div>
</td>
</tr>
</div>
</ng-container>
Once you start needing FormArrays, I would suggest that you consider https://formly.dev/. I recommend Formly for any Angular form more complicated than 3 fields. Angular Forms are, IMO, medium-low level things. A higher level abstraction like Formly is much nicer for developers
JSON powered / Dynamic forms in Angular