0:CategoryId: "31b7a227-9fda-4d14-8e1f-1dee5beeccb4"Code: "GMA0300"Description: "PA-5215: Renamed"Enabled: trueFavorite: falseId: "26cfdb68-ef69-4df0-b4dc-5b9c6501b0dd"InstrumentType: nullMoniker: "1GMA0300"Name: "Celiac Disease Panel (tTG IgG, tTG IgA, DGP IgG)"Tests: Array(3) 0: Code: "GMA0304" Id: "e2bb4607-c227-4483-a3e9-55c1bc5a6781" Name: "Deamidated Gliadin Peptide (DGP) IgG" __proto__: Object 1: {Id: "2fcd610f-d453-4c4f-a8dc-1a5f50e88548", Code: "GMA0301", Name: "Tissue Transglutaminase (tTG) IgA"} 2: {Id: "de41b236-4866-419a-a6f4-5f7c1440d30f", Code: "GMA0302", Name: "Tissue Transglutaminase (tTG) IgG"} length: 3 __proto__: Array(0) TestsSelectable: false嘿,這是一個數(shù)組selectedPanels對象,它有另一個對象數(shù)組,我已經(jīng)在面板中映射了這個對象,面板上有復(fù)選框,而Tests是一個可擴(kuò)展的行數(shù)組,也有復(fù)選框當(dāng)我檢查面板復(fù)選框時,它會檢查測試的所有子復(fù)選框,并顯示測試的長度說3,但是當(dāng)我單擊每個測試時,它應(yīng)減去測試的長度,說3-1 = 2,它現(xiàn)在應(yīng)該顯示2,但是當(dāng)我使用拼接,當(dāng)我取消選擇每個測試復(fù)選框時,它會刪除整行,或者當(dāng)我單擊每個測試時,它已經(jīng)實現(xiàn)時,它取消選擇父面板復(fù)選框,當(dāng)我取消選擇每個測試時,我也不知道想要什么不刪除文本,但減少數(shù)組的長度您可以從該圖像中看到這是我的html文件<label class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" [name]="panel.Id + '-' + panel.Moniker" [ngModel]="checkAllTestsSelected(panel)" (ngModelChange)="onPanelCheckboxUpdate($event, panel)" [id]="panel.Id + '-' + panel.Moniker"> <span class="custom-control-indicator"></span> </label> </ng-template> <ng-template ngbPanelContent><div class="individual-panel" *ngFor="let test of panel.Tests"> <span class="text-dimmed">{{test.Name}}</span> <span *ngIf="panel.Name.includes('ENA') || panel.Name.includes('Celiac')"> <label class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" [name]="test.Id + '-' + test.Code" (ngModelChange)="onTestCheckboxUpdate($event, test, panel)" [id]="test.Id + '-' + test.Code"> <span class="custom-control-indicator"></span> </label> </span></div>數(shù)組在this.selectedPanels中如何解決此問題,有人可以幫忙嗎?
在Angular 4中取消選中復(fù)選框后,如何從JSON數(shù)組中刪除對象?
收到一只叮咚
2021-05-04 13:28:07