Fix ExpressionChangedAfterItHasBeenCheckedError

urls
Max 4 years ago
parent c078abc23c
commit 8de7d927c6

@ -6,6 +6,7 @@ import {
Output, Output,
ViewChild, ViewChild,
AfterViewInit, AfterViewInit,
ChangeDetectorRef,
} from '@angular/core'; } from '@angular/core';
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { CargoBikeResult } from 'src/app/services/bikes.service'; import { CargoBikeResult } from 'src/app/services/bikes.service';
@ -86,13 +87,14 @@ export class TableComponent implements AfterViewInit {
constructor( constructor(
private schemaService: SchemaService, private schemaService: SchemaService,
public dialog: MatDialog, public dialog: MatDialog,
private activatedroute: ActivatedRoute private activatedroute: ActivatedRoute,
private cdRef: ChangeDetectorRef
) { ) {
this.filter.includesString = this.filter.includesString =
this.activatedroute.snapshot.queryParamMap.get('filter') || ''; this.activatedroute.snapshot.queryParamMap.get('filter') || '';
} }
ngAfterViewInit() { ngAfterViewInit(): void {
this.addColumnPropertiesFromGQLSchemaToColumnInfo(); this.addColumnPropertiesFromGQLSchemaToColumnInfo();
this.data.paginator = this.paginator; this.data.paginator = this.paginator;
this.data.sortingDataAccessor = (item, columnName) => { this.data.sortingDataAccessor = (item, columnName) => {
@ -172,6 +174,7 @@ export class TableComponent implements AfterViewInit {
} }
} }
}, this.relockingIntervalDuration); }, this.relockingIntervalDuration);
this.cdRef.detectChanges();
} }
ngOnDestroy() { ngOnDestroy() {

Loading…
Cancel
Save