调用 HttpClient.get() 时如何替换 URL 中的标记
How to replace a token in the URL when calling HttpClient.get()
如何在以这种方式调用 httpClient.get()
时替换 URL 中的 ${fooId}
令牌:
this.httpClient.get('http://my-server/foo/${fooId}');
实际上我正在使用 this.httpClient.get('http://my-server/foo/${fooId}'.replace('${fooId}', fooId));
但我认为它不是很干净
使用反引号 ``
而不是简单的引号 '
如何在以这种方式调用 httpClient.get()
时替换 URL 中的 ${fooId}
令牌:
this.httpClient.get('http://my-server/foo/${fooId}');
实际上我正在使用 this.httpClient.get('http://my-server/foo/${fooId}'.replace('${fooId}', fooId));
但我认为它不是很干净
使用反引号 ``
而不是简单的引号 '