我试图在关闭对话框后实现函数调用,但是我不能使用管道也不能订阅它。让我们看看我的代码。
我收到此错误:
Type 'Observable<any>' is not assignable to type 'MatDialogRef<any, any>'. Property '_overlayRef' is missing in type 'Observable<any>'
想法是在关闭对话框时调用函数this.windowScrolling.disable ();
@Injectable({
providedIn: 'root'
})
export class NavegarService {
public offsets: number[];
windowScrolling: WindowScrollingService;
constructor(private router: Router,
private activatedRoute: ActivatedRoute,
windowScrolling: WindowScrollingService,
public dialogRef: MatDialogRef <any, any>,
private dialog: MatDialog) {
this.windowScrolling = windowScrolling;
this.offsets = this.range( 1, 20 );
}
navegarContext(url: string, event: any = null) {
this.router.navigate([url], {queryParams: {context: this.activatedRoute.snapshot.queryParams['context']}});
}
navegar(url: string, event: any = null) {
this.router.navigate([url]);
}
abrirModal(component: ComponentType<any>, dados: any, event: any = null): MatDialogRef<any, any> {
this.windowScrolling.disable();
return this.dialog.open(component, {minWidth: '90%', disableClose: true, data: dados, position: {top: '4%'}}).afterClosed()
.pipe(); // got error here
}
private range( from: number, to: number ): number[] {
const values = [];
for ( let i = from ; i <= to ; i++ ) {
values.push( i );
}
return( values );
}
}
答案 0 :(得分:0)
错误消息几乎完全说明了问题所在:您从方法返回的对象不是正确的类型。
要解决此问题,我们需要创建并存储新对话框,然后创建订阅,最后返回刚刚创建的对话框对象。
SELECT
customerid
,SUM(requests) sumDay
,created_timestamp
FROM yourTable
GROUP BY
customerid,
created_timestamp
HAVING SUM(requests) >= 10000;