0

Hi I have the following problem. I made an Angular Material table as in the example provided on the documentation site. My problem is now the table is rendered and also the right amount of rows is rendered but no columns and no data is displayed.

<div class="app-errors">
   <div class="spinner-container" *ngIf="dataSource.loading$ | async">
     <mat-spinner></mat-spinner>
   </div>
   <mat-table [dataSource]="dataSource">
     <ng-container matColumnDef="seqNo" >
        <mat-header-cell *matHeaderCellDef>#</mat-header-cell>
        <mat-cell *matCellDef="let data">{{data.id}}</mat-cell>
     </ng-container>

     <mat-header-row  *matHeaderRowDef="displayedColumns"></mat-header-row>
     <mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
   </mat-table></div>

Rendered:

<app-errors _nghost-c4="" class="ng-star-inserted">
 <div _ngcontent-c4="" class="app-errors">
   <!---->
   <mat-table _ngcontent-c4="" class="mat-table" role="grid"><!----><!---->
      <mat-row _ngcontent-c4="" class="mat-row ng-star-inserted" role="row">
           <!---->
      </mat-row>
   </mat-table>
  </div>
 </app-errors>
2
  • are you getting data in dataSource??? Commented Mar 14, 2018 at 9:10
  • yes data is in the dataSource. Tried it the way it should work later with a rest request to retrieve the data but also tried it with a local array of data but i get the same result rows are correct but columns and data not Commented Mar 14, 2018 at 9:16

1 Answer 1

1

Problem solved. Created a new project with the exact same configuration copied everything in there now it works. Very strange behavior

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.