Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZackDeRose/fff2602c10fdcb4da3e0196d3c1a923f to your computer and use it in GitHub Desktop.
Save ZackDeRose/fff2602c10fdcb4da3e0196d3c1a923f to your computer and use it in GitHub Desktop.
Snippet for conditional classes for "Angular CDK Tables" article
<!-- Hero Name Column -->
<ng-container cdkColumnDef="attack">
<th cdk-header-cell *cdkHeaderCellDef> Attack </th>
<td cdk-cell
*cdkCellDef="let row"
[ngClass]="{
'table-success': superlatives$.value['highest-attack'] === row.name,
'table-danger': superlatives$.value['lowest-attack'] === row.name
}">
{{row.attack}}
</td>
</ng-container>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment