按鈕,我想禁用我只要值不THD是被動態地從數據庫中創建下拉菜單的數量問題,選擇提交按鈕,所以我可能有2所列出年月禁用提交無效形式
或可能有三個月,一年,公司等。
component.html
<form #myForm="ngForm" (ngSubmit)="submit(myForm.value)">
<div class="container" style="width:100%; border:0px double ">
<div class="row left" *ngFor='let control of tabControls; let i = index' style="padding-bottom:3px">
<div class="col-lg-2 text-left" style="border:0px dotted">
{{control.DropDownTitle}}:
</div>
<div class="col-lg-pull-3 text-left">
<select name="{{control.DropDownTitle}}" [(ngModel)]="selected[i]" style="width:80%">
<option value="" selected>Select</option>
<option *ngFor='let controlList of control.DropdownValues' [ngValue]="controlList.Value">
{{controlList.Value}}
</option>
</select>
<input #myInput name="file" type="file" (input)="oninput($event)" style="width:80%" [disabled]='showDeleteButton' />
<button type="submit" class="btn btn-primary">Submit Values</button>
</form>
那麼你可能要考慮動態表單:https://angular.io/docs/ts/latest/cookbook/dynamic-form.html –