In my application I am looking for writing a function that deletes the number of check boxes selected from my array. I have written and i can console.log the the number of checkboxes i have selected. But im stuck at how to get index numbers of the selected check boxes and delete those only. And in delete function i have to spilce those number of rows from main array.

html -

```
     <ng-container *ngFor="let reasoncode of displayReasonCodes$ | async;let i = index">
    <tr class= "row-break">
    <checkbox type="checkbox"  name="sizecb[]" value="{{reasoncode.id}}"  [(ngModel)]="reasoncode.state">
      </checkbox>
      <td>  
      <form>
    <form-group>
    <textbox [readOnly]="isEditable" ngModel="{{reasoncode.ReasonCode}}"  name="textbox" ></textbox>
    </form-group>
    </form>
    </td>
    <td>
    <form>
     <form-group>
    <textbox  [readOnly]="isEditable" ngModel="{{reasoncode.Description}}" name="textbox1" ></atextbox>
    </form-group>
    </form>
    </td>
    <form>
    <p>
    <toggle-switch   ngModel="{{reasoncode.Status}}"   name="switch1"  ></toggle-switch>
    </p>
    </form>
    </tr>
    </ng-container>
    </tbody>
    </table>

```

COMPONENT.TS 

```
export class ReasonCodesComponent implements OnInit {

    checkAll(event: any) {
      if (!this.result) return;
      this.result.forEach((x: any) => x.state = event.target.checked)
      }

     isAllChecked() {
      if (this.arr) return;
      return this.result.every((_: any) => _.state);
      }
     check(result: any) {
     result.state == false;
      result.state! = result.state;
      }
    @select(store.displayReasonCodes) displayReasonCodes$: Observable<IReasonCodes>;

      arr: any[];
      state: any;
      $event: any;
      displayReasonCodes: any;
      x: any;
      _: any;
      result: any;
      isEditable: boolean;

     constructor(private reasonCodesActions: ReasonCodesActions) {
      }

      reasoncodeObject:Object;
      ngOnInit() {

    this.displayReasonCodes$.subscribe(data => this.result = data ) 
      }

    deleterow() { 
        this.result.forEach((x: any) => {
          if (x.state) {  alert(x.state)  /// here i am getting true as alert for number of rows selected and when i clcik on delete.

            let copyObj = this.displayReasonCodes$.subscribe(data1=>this.data=(JSON.parse(JSON.stringify(data1))));

            console.log(this.data)  ; //data contains the array of objects, from which i have to splice up the number of selected rows from table.

          };
        })
      }

    }

```

I am looking for to delete the rows selected in checkbox and display the rest ones left out.