I created sad-hover component which is really sad at the moment. Here is stackblitz https://stackblitz.com/edit/angular-sad-hover?file=app%2Fapp.component.ts Open developer tools to see console output.
Problem:
- I have isolated
sad-hover component which uses OnPush.
- Inside it I use (mouseleave) and (mouseover) and I don't want to trigger my whole app change detection to run.
- This component is used in parent
sad-cat component, and sad-cat is used on root app component.
- It turns out that zone is still grabbing these events and triggers parent component and root to update.
Solution:
Allow to have truly isolate component so everything that I make inside will stay inside, but I'm still be able to notify parent components about changes by using @Output();
One solution could be to allow inject zone and say than I don't want to trigger any parent's component's CD.
class MyIsolatedCmp {
constructor(zone: NgZone) {
zone.SkipParent();
}
}
I created sad-hover component which is really sad at the moment. Here is stackblitz https://stackblitz.com/edit/angular-sad-hover?file=app%2Fapp.component.ts Open developer tools to see console output.
Problem:
sad-hovercomponent which uses OnPush.sad-catcomponent, andsad-catis used on root app component.Solution:
Allow to have truly isolate component so everything that I make inside will stay inside, but I'm still be able to notify parent components about changes by using
@Output();One solution could be to allow inject zone and say than I don't want to trigger any parent's component's CD.