Skip to content

help(CdkTable): Cdk Table is not instantiated with production build #20302

Open
@bvkimball

Description

@bvkimball

When running ng serve everything works

Just upgraded to angular 10 and got everything working, finally got to running a prod build and not of my DataTables are loading. Using ng build --prod && npx angular-http-server --path ./dist -p 3001. It seems like the CdkTable is not instantiated because the DataSource.connect function is never called.

I have a component library that has also been upgraded to angular 10 and works, the component library has a DataTable component that use <cdk-table> like so: (this has been working with prior versions)

 <cdk-table
          [dataSource]="dataSource"
          [trackBy]="trackByFn"
          [class.expandable]="expandable"
          [class.empty]="dataSource?.currentlyEmpty && state.userFiltered"
          [hidden]="dataSource?.totallyEmpty && !state.userFiltered"
          #table
        >

I added @ViewChild('table') tableRef: CdkTable<T>; when I console.log this i get:
image

Environment

  • Angular: 10+
  • CDK/Material: 10.1.3
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/table

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions