我创建了一个包含 FormControl 的 FormGroup 并且我想要一些值应用属性“禁用:真/假”但是如果我编辑其中一个值,另一个是空的......
return this.formBuilder.group({
civilite: new FormControl({value: personne.civilite || '', disabled: personne.civilite }),
situationfamiliale: new FormControl({value: personne.situationfamiliale || '', disabled: personne.situationfamiliale }),
});
<div class="col-md-6 col-xl">
<div class="form-group">
<label for="situationFamiliale">{{'situation' | translate}}</label>
<ngx-select id="situationFamiliale" [items]="familyStatus" formControlName="situationFamiliale"
[allowClear]="true" placeholder="{{'CHOOSE_LBL' | translate}}"
noResultsFound="{{'NO_RESULTS_FOUND_LBL' | translate}}" >
<ng-template ngx-select-option-selected ngx-select-option let-option let-text="text" >
{{option.data.text | translate}}
</ng-template>
</ngx-select>
</div>
</div>
<div class="col-md-6 col-xl">
<div class="form-group">
<label for="civilite">{{'civilite' | translate}}</label>
<ngx-select id="civilite" [items]="civilities" formControlName="civilite" [allowClear]="true"
placeholder="{{'CHOOSE_LBL' | translate}}" noResultsFound="{{'NO_RESULTS_FOUND_LBL' | translate}}" >
<ng-template ngx-select-option-selected ngx-select-option let-option let-text="text" >
{{option.data.text | translate}}
</ng-template>
</ngx-select>
</div>
</div>
谢谢你的帮助 ;)