Needs improvement: MatTextColumn is calling dataAccessor method inside the template.
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
### Description
Call of `dataAccessor` method is against Angular best practices and will be bad for performance in tables with large data sets.
{{dataAccessor(data, name)}}
See [line 30 inside `MatTextColumn` for reference](https://github.com/angular/components/blob/main/src/material/table/text-column.ts#L30C11-L30C35).
### Reproduction
See [the Stackblitz and the example for `mat-text-column` inside the documentation here for a working example](https://material.angular.io/components/table/examples#table-text-column).
### Expected Behavior
Set the data in a variable inside the component on initialization and bind that to the template instead.
### Actual Behavior
It gets the data inside the template by calling the `dataAccessor` method.
### Environment
- Angular:
- CDK/Material:
Hướng dẫn đóng góp
Hướng nghiên cứu
Start by reading src/material/table/text-column.ts around line 30, then run the mat-text-column documentation example and its linked Stackblitz to observe the current behavior. Done means the template no longer calls dataAccessor for each table render, while the example continues to display the expected cell values.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend
- Loại issue
- Tái cấu trúc
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100