Have a component that re-renders when the window is resized (and this works well). However, there are some other components on the page that cause elements to appear/disappear. My component needs to re-render whenever the available space changes.
As this component only appears once in the app, I thought it would be safe to listen to window resize events like this...
@HostListener('window:resize') // re-render if window is resized
private render() {
// code that causes the contents of the component to re-render
}
This part works. For the other sibling components that collapse and expand areas of the page, I thought I could just call windows.dispatchEvent like this...
toggleRightSidebar() {
window.dispatchEvent(new Event('resize'));
this.settingsButtonClicked.emit();
}
But the sibling component that has the @HostListener doesn't detect a windows resize event triggered in this manner.
Am I missing something?