#sortChange - testing

4 messages · Page 1 of 1 (latest)

brittle fox
#

ReferentielDominanteComponent

export class ReferentielDominanteComponent extends TableBaseComponent

TableBaseComponent

    <custom-table

CustomTableComponent

  @ViewChild(MatSort, {static: true}) matSort!: MatSort;

  ngOnInit(): void {
    this.sub1 = this.matSort.sortChange.subscribe((sort: Sort)=> {
        this.sort.emit(sort);
    })
...

error

ReferentielDominanteComponent > should create
TypeError: Cannot read properties of undefined (reading 'sortChange')

small silo
#

I would start by avoiding the {static; true} hack, and using the appropriate lifecycle hook: ngAfterViewInit. Then, if you still have the issue, I would post a complete minimal reproduction.

brittle fox
#

when i retrieve : {static: true} they are an error : ERROR TypeError: Cannot read properties of undefined (reading 'sortChange')
at TableComponent.ngOnInit

small silo
#

and using the appropriate lifecycle hook: ngAfterViewInit