I have Angular CDK Overlay
for popovers, when I scroll page down, overlay moves up (because it has reposition scroll strategie).
Can I somehow trigger an event when the overlay moves up or down?
I have Angular CDK Overlay
for popovers, when I scroll page down, overlay moves up (because it has reposition scroll strategie).
Can I somehow trigger an event when the overlay moves up or down?
When I did this, I was able to access the change from the overlay reference config. It looked something like this:
export class MyClass {
constructor(private overlayRef: OverlayRef) {}
ngOnInit() {
const config = this.overlayRef.getConfig();
// positionChanges is private so this bypasses the error
const changes = (config.positionStrategy as any)['positionChanges']
changes.subscribe((change: ConnectedOverlayPositionChange) => {
// Do something when the position changes
});
}
}