Browse Source

feat(client): implement view child signal

pull/6893/head
KenTandrian 1 week ago
parent
commit
40e0852d62
  1. 8
      apps/client/src/app/components/admin-tag/admin-tag.component.ts

8
apps/client/src/app/components/admin-tag/admin-tag.component.ts

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

Loading…
Cancel
Save