[英]Angular reactive form display
I'm trying to do an reactive form but I have some problem with the visual part ^^我正在尝试做一个反应形式,但视觉部分有一些问题^^
Here is my html:这是我的 html:
<form class="text-center" [formGroup]="requeteModif" (ngSubmit)="modifier()" *ngIf="tableSelect != null">
<h5>Ajouter des informations</h5>
<div class="row">
<div class="col" *ngFor="let modification of modif.controls; let nomCol of nomColonne; let j=index" formArrayName="modif">
<label class="text-center">
{{nomCol}}
</label>
<div *ngFor="let infoTable of infoTable; let i = index;">
<input type="text" class="form-control" [formControlName]="i">
</div>
<div><button class="btn btn-primary" type="submit">Modifier</button></div>
</div>
</div>
</form>
What I want:我想要的是:
Col1 Col2
true A Button (get true, A)
false B Button
[EDIT] I have find a way to display it the way I want but I don't know how to arrange my code since I'm suppose to use variable.. [编辑] 我找到了一种方法来以我想要的方式显示它,但我不知道如何安排我的代码,因为我想使用变量..
<div *ngFor="let infoTable of infoTable; let i = index;">
<input *ngIf="j==0" type="text" class="form-control" [formControlName]="i">
<input *ngIf="j==1" type="text" class="form-control" [formControlName]="i+5">
</div>
j id the number of the columns, as you can see it's depend on the number of columns, using this way it's too static but I have no idea about how to fix it... j id 列数,如您所见,它取决于列数,使用这种方式也太 static 但我不知道如何修复它...
Sorry for my english Thank you !对不起我的英语谢谢!
I have find the answer, I just have use the data_binding but I didn't knew how it works ^^' [ngModel]我找到了答案,我只是使用了 data_binding 但我不知道它是如何工作的^^' [ngModel]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.