角度4 rxjs中的嵌套订阅

时间:2018-03-06 07:24:05

标签: angular rxjs

我打开一个模态并订阅模态中的事件,     然后当调用订阅时,我调用另一种方法(方法2),     方法2使用服务,我订阅该服务,但订阅永远不会运行

method1(selectedAudits) {
    this.bsModalref = this.bsModalService.show(SomeAngularComponent);
    this.bsModalref.content.someEventInSomeAngularComponent.subscribe(data => {
        //the subscription works 
        console.log('subscription works and messaged is logged to console')
            //methode 2 is successfully called 
        this.method2(data);
    });
}

method2(data) {
    //the service is called and data is send to server 
    this.someService.sendDataToServer(data).subscribe(result => {
        //??????????????????
        //why the subscrion doent work here ?
        console.log('this is second subscribtion that is never logged to console ')
    })
}

0 个答案:

没有答案
相关问题