我正在尝试编译我的代码以进行构建,但我的formArray循环其控件有困难
max_execution_time
我不确定如何重写像这样的部分
<div formArrayName="energyTips">
<h3>Energy Saving Tips</h3>
<div *ngFor="let energyTip of energyTips.controls; index as i" class="panel panel-default">
<md-grid-list cols="12" rowHeight="80px">
<md-grid-tile colspan="12">
<md-input-container>
<input mdInput placeholder="Energy Tip" [formControlName]="i" type="text" required>
<md-error *ngIf="energyTips.at(i).hasError('required')">Please fill the energy saving tip details before adding another one</md-error>
</md-input-container>
<button *ngIf="i == (energyTips.controls.length - 1 )" class="circle-buttons" md-fab (click)="addEnergyTip($event,energyTip)" color="primary" [disabled]="energyTips.at(i).hasError('required')"><md-icon>add</md-icon></button><span *ngIf="addGreenScreenForm.controls.energyTips.controls.length > 1"><button class="circle-buttons" md-fab (click)="removeEnergyTip(i)" color="primary"><md-icon>remove</md-icon></button></span>
</md-grid-tile>
</md-grid-list>
</div>
</div>
和controls.length
转换为兼容代码。
答案 0 :(得分:0)
一些但不限于AOT提示:
get energyTipsLength() {
return this.energyTips.controls.length;
}