Description
Bug, feature request, or proposal:
You got Missing definitions for header and row, cannot determine which columns should be rendered
if you manually control changeDetection in WrapperTable
example.
What is the expected behavior?
No error.
What is the current behavior?
It is very common that user want to control CD in his own code. this.table.addColumnDef(...)
and this.table.addRowDef(...)
called in ngAfterContentInit(...) are too late for this situation.
What are the steps to reproduce?
Replace the content of file https://github.com/angular/material2/blob/master/src/demo-app/table/custom-table/wrapper-table.ts with my fork version: https://github.com/jianliao/material2/blob/master/src/demo-app/table/custom-table/wrapper-table.ts
Run gulp serve:devapp
and navigate to http://localhost:4200/table/custom-table
You got this
ERROR Error: Missing definitions for header and row, cannot determine which columns should be rendered. at Object.getTableMissingRowDefsError (table-errors.ts:47) at MatTable.CdkTable.ngAfterContentChecked (table.ts:244) at callProviderLifecycles (provider.ts:558) at callElementProvidersLifecycles (provider.ts:534) at callLifecycleHooksChildrenFirst (provider.ts:522) at checkAndUpdateView (view.ts:365) at callWithDebugContext (services.ts:639) at Object.debugCheckAndUpdateView [as checkAndUpdateView] (services.ts:345) at ViewRef_.detectChanges (refs.ts:259) at WrapperTable.set [as columns] (wrapper-table.ts:53)
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Current latest Angular and Material library.