如何进行连锁

时间:2019-04-09 09:18:23

标签: javascript angular rxjs angular-material

嗨,我正在尝试链接以下订阅。

  changeBranch() {
const bottomSheetRef: MatBottomSheetRef = this.bottomSheet.open(CCSBranchComponent, {
  data: this.branches
});
this.subscription.add(bottomSheetRef.instance.change.subscribe((branch: Branch) => {
  this.branchInfo = `Description : ${branch.author}\nAuthor : ${branch.id}\nCreated date :${branch.created}`;
  this.blockpointBranchForm.get('branch').setValue(branch.id);
}));
this.subscription.add(bottomSheetRef.afterDismissed().subscribe(() => {
this.returnSelectedBranch.emit(this.blockpointBranchForm.get('branch').value);
}));

}

这里,如果在工作表加载之前调用了bottomSheetRef.instance.change.subscribe,则会引发未定义的情况。所以我正在尝试将工具看起来像这样

this.subscription.add(this.bottomSheet.open(CCSBranchComponent, {
  data: this.branches
}).instance.change.subscribe((branch: Branch) => {
  this.branchInfo = `Description : ${branch.author}\nAuthor : ${branch.id}\nCreated date :${branch.created}`;
  this.blockpointBranchForm.get('branch').setValue(branch.id);
}).afterDismissed().subscribe(() => {
this.returnSelectedBranch.emit(this.blockpointBranchForm.get('branch').value);
}));

在这里,第一个订阅在第一个订阅返回时被调用。如何访问链中的可观察物?

1 个答案:

答案 0 :(得分:0)

我想您想要的是将订阅时执行的操作链接起来。

您可以通过以下方式实现此目标

!./darknet detector test data/obj.data   cfg/yolov3_V1_config.cfg   /mydrive/yolov3_V1_config_last.weights /mydrive/yolov3/Poachers/pic2.jpg -thresh 0.3 -dont_show