angular / angular/components

feat(CDK Table): Able to inject row in cell

Đang mở
#29,114 3 bình luận 0 reaction 1 người được giao Được @andrewseguin nhận Xem trên GitHub
feature P4
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ả

### Feature Description

The same feature request was made in 2019 but was rejected #15733.
Andrew Seguin did not explain why the Angular Material Team does not plan on supporting this case.
Over the past few years, Angular has changed a lot, so I am trying to ask again.

### Use Case

![wawa2](https://github.com/angular/components/assets/8691013/2ac78c40-7935-49cc-8204-de7291541fc5)
I am trying to do a hover header to show all cell border effects, similar to the Google Ads table (as shown in the GIF above).

My idea is to create two directives (Row and Cell).
Row listens to mouse enter events and then queries all Cell instances to call Cell.showBorder(). However, I know that Angular query is based on the LView tree, not the DOM tree, so the Row can't query its Cells.

I tried another way, where Cell injects its Row. However, this also didn't work. After checking the code, I found that when CdkTable creates cell embedded view, it does not specify injector
![image](https://github.com/angular/components/assets/8691013/4d7039f3-a5de-4e78-b8df-f0ea84257788)
This is the reason why Cell cannot inject Row.

I'm not sure if the new Angular team will change their attention, but I hope to at least get an explanation.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.