Ram Kumar
Ram Kumar

Reputation: 275

how to use limitTo in angular

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

Upvotes: 2

Views: 407

Answers (1)

Navruzbek Noraliev
Navruzbek Noraliev

Reputation: 716

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>

Upvotes: 5

Related Questions