<mat-sidenav-content cdkScrollable>和
构造函数(公共滚动: ScrollDispatcher) {
this.scrollingSubscription = this.scroll
.scrolled()
.subscribe((data: CdkScrollable) => {
this.onWindowScroll(data);
});}
如何取消订阅,因为它将在其他组件中处于活动状态
发布于 2019-07-27 22:43:46
this.scrollingSubscription = this.scroll.scrolled().subscribe();然后在你需要它的地方使用下面的代码
this.scrollingSubscription.unsubscribe();可能在组件ngOnDestroy(){}方法中。
https://stackoverflow.com/questions/57233089
复制相似问题