我如何在ConnectedPositionStrategy叠加层中添加位置策略()?(我正在使用Angular Material.)
我已经尝试通过positionStrategy属性指定它并将其传递给overlay.create().
import { Overlay, ConnectedPositionStrategy } from '@angular/cdk/overlay';
// ...
export class MyComponent {
constructor(private overlay: Overlay){}
showOverlay() {
let overlay = this.overlay.create({positionStrategy: ConnectedPositionStrategy});
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
ERROR in src/app/explore/explore.component.ts(48,40): error TS2345: Argument of type '{ positionStrategy: typeof ConnectedPositionStrategy; }' is not assignable to parameter of type 'OverlayConfig'.
Types of property 'positionStrategy' are incompatible.
Type 'typeof ConnectedPositionStrategy' is not assignable to type 'PositionStrategy'.
Property 'attach' is missing in type 'typeof …Run Code Online (Sandbox Code Playgroud) 我正在尝试为表格单元格制作自定义弹出框,以便在单击时显示单元格详细信息,其方式类似于mdBoostrap popovers。
现在,我有以下应用程序:https : //stackblitz.com/edit/angular-m5rx6j
Popup 组件显示在主组件下,但我想将它显示在表格上方,就在我单击的元素下方。
我想我需要执行以下操作: