使用方法GET的Angular HttpClient参数不起作用

我想用get方法向你询问params.
我有这样的事:
path = 'https://example.com/api';
    const params = new HttpParams();
    params.append('http','angular');
    return this.http.get(path,{params: params});

我以为我会像以下网址:

www.example.com/api?http=angular

但实际上当我在chrome中的网络选项卡中检查时,请求url是

www.example.com/api

当我想要路径时,我该怎么办:www.example.com/api?http=angular
是否可以检查没有铬的使用方法的请求URL?我的意思是在使用该方法的服务中?

提前致谢

您需要在追加函数调用后重新分配.它返回一个新的 HttpParams对象.
const params = new HttpParams().append('http','angular');

这是the documentation of append.您可以看到它返回HttpParams实例

append(param: string,value: string): HttpParams

Construct a new body with an appended value for the given parameter name.

And is it possible to check request url of used method without chrome ?

您可以创建一个HttpInterceptor并查看将在拦截函数实现中使用的整个URL.

相关文章

ANGULAR.JS:NG-SELECTANDNG-OPTIONSPS:其实看英文文档比看中...
AngularJS中使用Chart.js制折线图与饼图实例  Chart.js 是...
IE浏览器兼容性后续前言 继续尝试解决IE浏览器兼容性问题,...
Angular实现下拉菜单多选写这篇文章时,引用文章地址如下:h...
在AngularJS应用中集成科大讯飞语音输入功能前言 根据项目...
Angular数据更新不及时问题探讨前言 在修复控制角标正确变...