From 8de7d927c623afb90794a84b61e097fa01d9a3ae Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 28 Nov 2020 14:37:33 +0100 Subject: [PATCH] Fix ExpressionChangedAfterItHasBeenCheckedError --- src/app/components/table/table.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/components/table/table.component.ts b/src/app/components/table/table.component.ts index 4250556..af8368d 100644 --- a/src/app/components/table/table.component.ts +++ b/src/app/components/table/table.component.ts @@ -6,6 +6,7 @@ import { Output, ViewChild, AfterViewInit, + ChangeDetectorRef, } from '@angular/core'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { CargoBikeResult } from 'src/app/services/bikes.service'; @@ -86,13 +87,14 @@ export class TableComponent implements AfterViewInit { constructor( private schemaService: SchemaService, public dialog: MatDialog, - private activatedroute: ActivatedRoute + private activatedroute: ActivatedRoute, + private cdRef: ChangeDetectorRef ) { this.filter.includesString = this.activatedroute.snapshot.queryParamMap.get('filter') || ''; } - ngAfterViewInit() { + ngAfterViewInit(): void { this.addColumnPropertiesFromGQLSchemaToColumnInfo(); this.data.paginator = this.paginator; this.data.sortingDataAccessor = (item, columnName) => { @@ -172,6 +174,7 @@ export class TableComponent implements AfterViewInit { } } }, this.relockingIntervalDuration); + this.cdRef.detectChanges(); } ngOnDestroy() {