Angular Material Table Cell Formatting

后端 未结 4 1386
被撕碎了的回忆
被撕碎了的回忆 2021-02-10 14:04

I\'m using angular material table for displaying data and dyanmically binding the table header and table data. Is there any way to format particaular column\'s cell content dyn

4条回答
  •  [愿得一人]
    2021-02-10 14:48

    If you want to style cells on a mat-table you can target every element inside by using the ::ng-deep CSS selector like this:

    ::ng-deep th.mat-header-cell{
        width: 140px;
        min-width: 140px;
    }
    

    You can also use [ngClass] to apply classes to a cell based on a condition like this:

     
       Outcome 
      {{element.outcome == '' ? "not provided" : "provided"}} 
    
    

    and you just define the classes in your CSS file

提交回复
热议问题