Issue
StrictTemplate is complaining that a SortDirection is not a string. However, an enum is a string, isn't it?
Type 'string' is not assignable to type 'SortDirection'.
<mat-table matSort matSortDirection="{{ this.sort.direction }}" ...
The definition of SortDirection is:
export declare type SortDirection = 'asc' | 'desc' | '';
Is there a way to convert it to string?
I tried matSortDirection="{{(string)this.sort.direction}}"
and matSortDirection="{{this.sort.direction.toString()}}"
but fail.
What's the best way to convert it?
Solution
I thought and came to the conclusion that the problem is that I'm converting to string when I use interpolation. It is correct to use binding.
[matSortDirection]="sort.direction"
Answered By - Rodrigo Lanes
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.