我在一个类中有两个函数,两个类都从API调用中获取数据。Angular2在另一个具有相同类的函数中调用函数,并在第二个函数中使用第一个函数属性
这里是第一功能
getQuotes(){
this.quoteService.getQuotes()
.subscribe(
quotes => {
this.quotCode = this.quotes.BasicDetails[0].QuotCode;
}
});
}
二功能
getOption(){
this.quoteService.getOptions()
.subscribe(
options => {
})
}
我想从第一功能
this.quotCode = this.quotes.BasicDetails[0].QuotCode;
得到这一行数据,并基于this.quotCode
getOption()
将有不同的参数传递,并会得到差异。反应也。因此,有必要使用this.quotCode
在第二功能
我打电话getQuotes()
在constuctor()
任何人都可以请帮我吗? 谢谢
@trichetriche你能帮忙吗? –