在图像中,对话框[[top]上的MatDialog框],我有一个组件(MyNewDetailComponent
),我将通过Overlay打开它,并将scrollOptions
设置为reposition()
。 问题是当我在对话框组件中滚动时,Overlay组件没有重新定位。
这里是Code
export class MyComponent{
constructor(protected overlay: Overlay,
protected scrollStrategyOptions: ScrollStrategyOptions,
protected viewContainerRef: ViewContainerRef) {
const strategy = this.overlay.position()
.connectedTo(cdkOverlayOrigin.elementRef, { originX: 'end', originY: 'bottom' }, { overlayX: 'end', overlayY: 'top' })
.withOffsetX(5)
.withOffsetY(0);
const config = new OverlayConfig({ positionStrategy: strategy, scrollStrategy: this.overlay.scrollStrategies.reposition(), width: '285px', hasBackdrop: false });
this.testOverlayRef = this.overlay.create(config);
const componentReference = this.testOverlayRef.attach(
new ComponentPortal(MyNewDetailComponent, this.viewContainerRef));
this.testOverlayRef.updatePosition();
}
在图像中,它在对话框顶部的MatDialog框中,我有一个Component(MyNewDetailComponent),它将通过Overlay打开它,并将scrollOptions设置为reposition()。问题是...