Search code examples
angularangular-materialmat-tablemat-table-exporter

How do we subscribe to the currently shown data in Angular Material Tables


I need to know when the currently shown data inside material table changes and I need to subscribe to that change. If paginator is present, I need to get only the current page data.

How do we do that?


Solution

  • You can subscribe to datasource.connect() in order to get currently shown data changes. It only provides currently rendered data.

    this.dataSource.connect().subscribe(d => console.log(d));