bug(matTooltip): tooltip doesn't work with ChangeDetectionStrategy.OnPush
See original GitHub issueIs this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
I have a table with tooltips inside rows:
<ng-container matColumnDef="icons">
<th mat-header-cell *matHeaderCellDef>#</th>
<td mat-cell *matCellDef="let element">
<span [matTooltip]="'Hello, world'" matTooltipPosition="below"
>tooltip</span>
</td>
</ng-container>
The table can have thousands of rows, that’s why I have to use ChangeDetectionStrategy.OnPush. However, with such strategy tooltips are shown without text.
Reproduction
StackBlitz demo is here
Expected Behavior
Tooltips must be shown with text.
Actual Behavior
Tooltips are shown without text
Environment
- Angular: 13.3.9
- CDK/Material: 13.3.7
- Browser(s): FF 95
- Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
javascript - Angular material tooltip problem with ...
The table can have thousands of rows, that's why I have to use ChangeDetectionStrategy.OnPush . However, with such detection strategy I have a ......
Read more >How to use matTooltip in Angular Material ? - GeeksforGeeks
First, install the angular material using the above-mentioned command. After completing the installation, Import 'MatTooltipModule' from '@ ...
Read more >Expression changed after checked error on template : r/Angular2
I'm trying to hide/show a matTooltip programatically and I succeed ... Make sure to set the change Detection strategy to OnPush set on...
Read more >Angular 9 — Change Detection with Pipe and OnPush Strategy
A Comprehensive Guide to Angular onPush Change Detection Strategy ... To demonstrate this issue, change the previous example to filter the ...
Read more >May 14 2019 05:43 UTC - angular/angular - Gitter
no bhai i want to open on a click of a button. irfanmayo0786 ... Does anyone meet the error message like this: ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@crisbeto Thank you very much for your explanation. This is a modified version of the demo with three modifications:
detach()
is commentedfooTest
getter in .ts{console.log('change was checked'); return true;}
{{fooTest}}
in .htmlWith these modifications when you move mouse over tooltip you see in console
change was checked
. So, when we don’t calldatach()
method in constructor angular continues to check view/model. And when I have thousands of rows and any event is processed (keypress, mouse wheel etc) I see serious performance problems although nor view nor model has been changed.@crisbeto I detach it because I use
onPush
strategy. If I don’t callthis._changeDetectorRef.detach();
then angular doesn’t work inonPush
mode (as I understand and as I tested - I am NOT experienced angular user).