【问题标题】:How to pass multiple argument in a get method in Angular?如何在Angular的get方法中传递多个参数?
【发布时间】:2021-11-03 19:29:35
【问题描述】:

我需要在 get 方法中传递 3 个参数,但问题是 get 方法需要 1-2 个参数。怎么解决?

【问题讨论】:

    标签: angularjs-directive angular10


    【解决方案1】:
    const params = new HttpParams()
       .set('p1', 'one!')
       .set('para2', "two")
       .set('para3', "three");
    

    然后

    this.httpClient.get<any>(yoururl,{params}) // {params} short form of {params:params}
    
    

    【讨论】:

      猜你喜欢
      • 2020-09-11
      • 1970-01-01
      • 2016-07-16
      • 2023-01-27
      • 1970-01-01
      • 2017-03-08
      • 1970-01-01
      • 2018-05-13
      • 1970-01-01
      相关资源
      最近更新 更多