Angular6 Material6 Error: "There can only be one default row without a when predicate function."

It turns out I was missing directive multiTemplateDataRows from <table> tag:

<table mat-table [dataSource]="licenses" multiTemplateDataRows ...

This error could also appear if the function in your when predicate is undefined. So if you have

<mat-tree-node *matTreeNodeDef="let node; when: hasChild">

and hasChild is undefined, you could get that error.


i had same problem. i updated @angular/cdk & @angular/material to 6.4.7. And all work fine. Of course you need multiTemplateDataRows attr as well