我该如何使用带有角度2+的get方法传递身体?

时间:2020-02-04 12:24:17

标签: typescript angular6 angular5

我的get方法Api是"http://abc/abc"

实际上,get方法包含get(url,options),只有两个参数。

但是在我的情况下,我必须通过这个。 身体就像

{
    "startIndex":"1",
    "count":"150",
    "groupBy":"product",
    "searchTerm":"product:product1"
}

我将如何通过get方法传递它? 有人可以帮我吗?

2 个答案:

答案 0 :(得分:0)

信息必须通过url作为参数发送

   let startIndex="1";
    let startIndex="150";
    let startIndex="product";
    let searchTerm="product:product1";
     return this.http.get(`http://abc/abc?startIndex=${startIndex}&count=${count}&groupBy=${groupBy}&searchTerm=${searchTerm}`);

答案 1 :(得分:0)

您无法在“获取回复”中传递正文。 将其发布(URL,选项),并在订阅中获取响应。 这将有动态数据调用