在具有反应形式的 angular v4 中使用禁用状态时无法将复选框值设置为 false

Unable to set checkbox value to false when using disabled state in angular v4 with reactive forms

我将使用表单生成器构建表单并包含以下内容:

myCheckbox: [{ value: true, disabled: false }, ''],

然后我将尝试修补该值,但这仅在我从 false 变为 true 时才有效,而不是从 true 变为 false:

 this.myForm.get('selectedItem').patchValue({
                selectedItem1: [{ value: false, disabled: false }, '']
            });

我错过了什么吗?一切正常,直到我使用推荐的方法来处理禁用状态。

html 中的复选框如下所示:

<label class="checkbox-inline"><input type="checkbox" name="selectedItem1" formControlName="selectedItem1">Week 1</label>

应该是:

this.myForm.get('selectedItem').patchValue({
    myCheckbox: false
});