1

I want to apply some CSS styling for the mdTooltip attribute in a md-cell of a cdk table.

Something like this:

<ng-container cdkColumnDef="Content">
  <md-header-cell *cdkHeaderCellDef md-sort-header> {{"Content" | translate}} </md-header-cell>
  <md-cell *cdkCellDef="let row" class="content" mdTooltip="{{row['Content'] }}"> {{row['Content'] }} </md-cell>
</ng-container>

And in my css I did something like this

/deep/ .content[mdTooltip] {
     white-space: pre-wrap;
}

But it is not working.

How can I fix this problem?

Appreciate the help.

m4n0
  • 29,823
  • 27
  • 76
  • 89
Alex
  • 143
  • 10

1 Answers1

0

After searching around, found the solution.

Thanks for Axel's Comment

Add an new attribute mdTooltipClass="foo".

    <ng-container cdkColumnDef="Content">
      <md-header-cell *cdkHeaderCellDef md-sort-header> {{"Content" | translate}} </md-header-cell>
      <md-cell *cdkCellDef="let row" mdTooltip="{{row['Content'] }}" mdTooltipClass="foo"> {{row['Content'] }} </md-cell>
    </ng-container>

CSS side

/deep/ .foo {
   white-space: pre-wrap;

}

The problem fixed.

Alex
  • 143
  • 10