第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

FormGroup 異步問題 Edge 與 Angular 中的 Chrome

FormGroup 異步問題 Edge 與 Angular 中的 Chrome

梵蒂岡之花 2023-09-25 16:59:02
我創(chuàng)建了一個 FormGroup,根據(jù)是否選中復(fù)選框,部分需要禁用。這適用于我的代碼,但過了一段時間我發(fā)現(xiàn)它不適用于 Microsoft Edge(僅使用 Chrome 進行了測試)。它只會有反應(yīng)我看了一下我的代碼,似乎我犯了一個錯誤,并且 Microsoft Edge 上顯示的 UI 是正確的,但 Chrome 中的 UI 卻不是。在我看來,這像是一個異步問題,因為如果我設(shè)置了console.log()after this.checkinForm.controls['releaseDropdown'].enable(),那么在第一次單擊該復(fù)選框后,它不會在 Chrome 中記錄任何內(nèi)容。第二次重新單擊它后,它會啟用,但隨后該復(fù)選框未被選中,應(yīng)該被禁用。有人看到我做錯了什么嗎?Stackblitz https://stackblitz.com/edit/angular-wqsd3y我的代碼如下所示:打字稿checkinForm: FormGroup;...ngOnInit(): void {... this.checkinForm = this.formBuilder.group({      isCheckedRelease: new FormControl(false),      releaseDropdown: new FormControl({value: null, disabled: true}),      newRelease: new FormControl({value: null, disabled: true}),      description: new FormControl(null),      isCheckedConfig: new FormControl(false)    });...} onCheckboxReleaseClick(){    if(this.checkinForm.controls['isCheckedRelease'].value === true){      this.checkinForm.controls['releaseDropdown'].enable()      this.checkinForm.controls['newRelease'].enable()    }else{      this.checkinForm.controls['releaseDropdown'].disable()      this.checkinForm.controls['newRelease'].disable()    }  }超文本標(biāo)記語言<form [formGroup]="checkinForm">    <div>        <label>The default chosen release in the configuration is: &nbsp;</label>        <label style="color: red;"> {{defaultBranch}}</label>    </div>    <div>        <label>Create or select a release for {{name}} </label>        <input class="my-checkbox" formControlName="isCheckedRelease" type="checkbox" (click)="onCheckboxReleaseClick()" />    </div>
查看完整描述

1 回答

?
溫溫醬

TA貢獻1752條經(jīng)驗 獲得超4個贊

發(fā)現(xiàn)以下修復(fù):

 (click)

<div>
    <label>Create or select a release for {{name}} </label>
    <input class="my-checkbox" formControlName="isCheckedRelease" type="checkbox" (click)="onCheckboxReleaseClick()" />
    </div>

 (change)

<div>
    <label>Create or select a release for {{name}} </label>
    <input class="my-checkbox" formControlName="isCheckedRelease" type="checkbox" (change)="onCheckboxReleaseClick()" />
    </div>


查看完整回答
反對 回復(fù) 2023-09-25
  • 1 回答
  • 0 關(guān)注
  • 125 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號