// How to truncate a string in Angular <td *matCellDef="let animal"> {{ (animal.name.length > 20) ? (animal.name | slice:0:20) + '...' : animal.name }} </td>