0
如何將路由器參數(我正在使用Angular 2)的結果替換爲123
?如何使用另一個Observable中的某個項目
this.data = this.apollo.watchQuery({
query: query,
variables: {
custNum: 123
}
})
.map(({data}) => data.allCustomers.nodes);
通常情況下,我將訪問PARAMS這樣的...
this.route.params
.switchMap((params: Params) => this.customerService.getCustomer(+params['id']))
.subscribe((results: any) => this.data = results);
但我不再有一個的CustomerService,並希望使用阿波羅查詢代替。但不太清楚如何把它們放在一起?
不能添加watchQuery裏面訂閱route.params嗎? –