Angular 已禁用窗体控件的属性以删除数据

Angular 已禁用窗体控件的属性以删除数据,angular,Angular,我创建了一个FormGroup,其中包含一个FormControl,我希望为某些值应用属性“disabled:true/false”,但如果我编辑其中一个值,另一个值为空 return this.formBuilder.group({ civilite: new FormControl({value: personne.civilite || '', disabled: personne.civilite }), situationfamiliale: new FormControl({

我创建了一个FormGroup,其中包含一个FormControl,我希望为某些值应用属性“disabled:true/false”,但如果我编辑其中一个值,另一个值为空

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>
返回this.formBuilder.group({
civilite:new FormControl({value:personne.civilite | | |“”,disabled:personne.civilite}),
情景家庭:新表单控件({value:personne.情景家庭| | |“”,disabled:personne.情景家庭}),
});
{{'situation'| translate}}
{{option.data.text | translate}}
{{'civilite'| translate}
{{option.data.text | translate}}


谢谢你的帮助;)

也发布HTML代码。我不太理解这个问题,但请记住,如果禁用了一个FormControl,则需要使用
myForm.getRawValue()
而不仅仅是
myForm.value
来获取所有值,请参阅Eliseo如果我使用getRawValue,则返回null如何编辑personne?如何在代码中更新此对象?这是工作:D我只是没有在好的文件中使用getRawValue。。谢谢你们的帮助,伙计们!