src/lib/select-row/checkbox-cell/checkbox-cell.component.ts
changeDetection | ChangeDetectionStrategy.Default |
selector | td[rxap-checkbox-cell] |
imports |
MatCheckboxModule
|
styleUrls | ./checkbox-cell.component.scss |
templateUrl | ./checkbox-cell.component.html |
Properties |
|
Inputs |
constructor(selectRow: SelectRowService<Data>)
|
||||||
Parameters :
|
element | |
Type : Data
|
|
Required : true | |
Public Readonly selectRow |
Type : SelectRowService<Data>
|
Decorators :
@Inject(SelectRowService)
|
import {
ChangeDetectionStrategy,
Component,
Inject,
Input,
} from '@angular/core';
import { Required } from '@rxap/utilities';
import { SelectRowService } from '../select-row.service';
import { MatCheckboxModule } from '@angular/material/checkbox';
@Component({
// eslint-disable-next-line @angular-eslint/component-selector
selector: 'td[rxap-checkbox-cell]',
templateUrl: './checkbox-cell.component.html',
styleUrls: ['./checkbox-cell.component.scss'],
changeDetection: ChangeDetectionStrategy.Default,
imports: [MatCheckboxModule]
})
export class CheckboxCellComponent<Data extends Record<string, any>> {
@Input({ required: true })
public element!: Data;
constructor(
@Inject(SelectRowService)
public readonly selectRow: SelectRowService<Data>,
) {
}
}
<mat-checkbox
(change)="selectRow.selectionModel.toggle(element)"
[checked]="selectRow.selectionModel.isSelected(element)">
</mat-checkbox>
./checkbox-cell.component.scss