Angular 全选复选框不应选中禁用复选框

Angular 全选复选框不应选中禁用复选框,angular,typescript,Angular,Typescript,拥有datatable,如果选中“全选”复选框,则需要选择启用复选框记录和避免禁用记录中的哪些。我尝试了下面的代码,我无法限制禁用的记录选择 checkuncheckall() { const totalChecked = this.persons.filter(f => f.checked).length; const target = totalChecked !== this.persons.length; this.persons.forEach(f =

拥有datatable,如果选中“全选”复选框,则需要选择启用复选框记录和避免禁用记录中的哪些。我尝试了下面的代码,我无法限制禁用的记录选择

  checkuncheckall() {
    const totalChecked = this.persons.filter(f => f.checked).length;
    const target = totalChecked !== this.persons.length;
    this.persons.forEach(f => (f.checked = target));
    this.cdRef.detectChanges();
  }
html代码:

<td><input type="checkbox" [disabled]="person.firstName === 'Superman'" class="checkboxCls" [value]="person.checked" [checked]="person.checked" name="id" (change)="person.checked = !person.checked"></td>

checkuncheckall(){
//第一个过滤器启用复选框
const filteredcheckbox=this.persons.filter(f=>f.firstName!==“超人”);
const totalChecked=filteredcheckbox.filter(f=>f.checked).length;
const target=totalChecked!==filteredcheckbox.length;
filteredCheckboxesforEach(f=>f.checked=target);
this.cdRef.detectChanges();
}