2

I have tried to display only 10 characters in the row of a table, for that I have used

 limitTo: 10 

but it is not working,

HTML code:

            <ng-container matColumnDef="user_profile_id" >
              <mat-header-cell *matHeaderCellDef mat-header-cell mat-sort-header> User ID </mat-header-cell>
              <mat-cell *matCellDef="let row " data-label="User UID" matTooltip={{row.user_profile_id}} > {{row.user_id| limitTo:10}} </mat-cell>
            </ng-container>

when I add " | limitTo:10" screen is displaying empty, I am not seeing any errors in the console also.

how can I solve this? I am using angular 8

Ram Kumar
  • 245
  • 1
  • 2
  • 10
  • 1
    Does this answer your question? [Angular: limitTo pipe not working](https://stackoverflow.com/questions/40028456/angular-limitto-pipe-not-working) – Erbsenkoenig Jan 28 '20 at 10:51

1 Answers1

5

in angular 8 you don't have limitTo pipe instead use slice pipe (docs): here is your code:

 <ng-container matColumnDef="user_profile_id" >
     <mat-header-cell *matHeaderCellDef mat-header-cell mat-sort-header> User ID </mat-header-cell>
     <mat-cell *matCellDef="let row " data-label="User UID" matTooltip={{row.user_profile_id}} > {{row.user_id| slice:0:10}} </mat-cell>
 </ng-container>