getQuotes(){
let params = {
"Type": "BasicDetail",
}
return this.http.post(this.url,params)
.map(res => res.json())
}
getOptions(){
let params = {
"Type": "Hoteloption",
}
return this.http.post(this.url,params)
.map(res=>res.json())
}
getServiceWiseOptions(){
let params = {
"Type": "ServiceWiseOption",
}
return this.http.post(this.url,params)
.map(res=>res.json())
}
getOption()
在我的组件代码中
constructor
组成部分输电系统
getOption() {
this.quoteService.getQuotes().mergeMap( quotes => {
if(this.quotes.BasicDetails[0].QuotType == 'QUOTTYP-3'){
return this.quoteService.getServiceWiseOptions()
}
else{
return this.quoteService.getOptions()
}
})
.subscribe(
options => {
this.optionsdata = options.resultData;
if(this.quotes.BasicDetails[0].QuotType == 'QUOTTYP-3'){
this.servicewiseData = options.resultData.ServiceWiseOption;
}else{
this.servicewiseData = options.resultData.Hoteloption;
}
},
)
}
我需要的是打电话
getServiceWiseOptions()
getOptions()
getOption()
如果我得到
QuotType:
getServiceWiseOptions()
getOptions()
上述功能
getOption()
有时可以工作,但有时不调用这两个函数中的任何一个。
请给我一些建议,我该怎么办?
我认为它的问题在于
mergeMap()