Skip to content

Commit

Permalink
Clear selection when updating search term #713
Browse files Browse the repository at this point in the history
  • Loading branch information
caebr committed Dec 4, 2024
1 parent 529898d commit 912b34e
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AsyncPipe } from "@angular/common";
import {
ChangeDetectionStrategy,
Component,
effect,
input,
model,
output,
Expand Down Expand Up @@ -49,7 +50,15 @@ export class EventsStudentsStudyCourseListComponent {
this.selectionService.selection$.pipe(map((selection) => selection.length)),
);

constructor(public selectionService: StudyCourseSelectionService) {}
constructor(public selectionService: StudyCourseSelectionService) {
effect(
() => {
this.searchTerm();
this.selectionService.clear();
},
{ allowSignalWrites: true },
);
}

onToggleAll(checked: boolean): void {
this.selectionService.clear(checked ? this.entries() : null);
Expand Down

0 comments on commit 912b34e

Please sign in to comment.