1

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?

Arkadi
  • 1,153
  • 1
  • 14
  • 35

1 Answers1

1

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
    });
  }
}
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338