diff --git a/apps/client/src/app/components/admin-tag/admin-tag.component.ts b/apps/client/src/app/components/admin-tag/admin-tag.component.ts index 4edd014aa..f5cb78395 100644 --- a/apps/client/src/app/components/admin-tag/admin-tag.component.ts +++ b/apps/client/src/app/components/admin-tag/admin-tag.component.ts @@ -14,7 +14,7 @@ import { inject, Input, OnInit, - ViewChild + viewChild } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { MatButtonModule } from '@angular/material/button'; @@ -55,13 +55,13 @@ import { CreateOrUpdateTagDialogParams } from './create-or-update-tag-dialog/int export class GfAdminTagComponent implements OnInit { @Input() locale = getLocale(); - @ViewChild(MatSort) sort: MatSort; - public dataSource = new MatTableDataSource(); public deviceType: string; public displayedColumns = ['name', 'userId', 'activities', 'actions']; public tags: Tag[]; + private readonly sort = viewChild.required(MatSort); + private readonly changeDetectorRef = inject(ChangeDetectorRef); private readonly dataService = inject(DataService); private readonly destroyRef = inject(DestroyRef); @@ -142,7 +142,7 @@ export class GfAdminTagComponent implements OnInit { this.tags = tags; this.dataSource = new MatTableDataSource(this.tags); - this.dataSource.sort = this.sort; + this.dataSource.sort = this.sort(); this.dataSource.sortingDataAccessor = get; this.dataService.updateInfo();