这是正常行为吗?是否在启动时调用它以及何时加载queryParams?
我在我的ngOnInit()中订阅了我的queryParams,如下所示:
this.subscription = this.editorService.paramObs.subscribe(
(params: Params) => {
/* my code here gets executed two times */
}
)
答案 0 :(得分:0)
您需要取消订阅组件销毁。查看更多详情:http://brianflove.com/2016/12/11/anguar-2-unsubscribe-observables/