0

Please Help me I need to retrieve a list of details using a list of parameters. How to achieve that from angular 10 and .net Core?

Also, Single Entries is working for search. But If I try to enter a second entry in the input field and tried to search it is not working.

The method name is GetPodForwardings.

1

This is the Method in angular (Service)

GetPodForwardings(conNo,newPage,pageSize)
{
    return this.http.get(`${this.BaseUrl}Pod/GetConsignmentList?conNo=${conNo}&newPage=${newPage}&pageSize=${pageSize}`)
  }

In .NET Controller

[Microsoft.AspNetCore.Mvc.Route("GetConsignmentList")]
[HttpGet]
public async Task<IActionResult> GetListofConsignments([FromQuery]List<long> conNo,int currentPage,int pageSize)
{
    return await ProcessQuery(new GetListofConsignmentByConsignmentNoQuery(conNo,currentPage,pageSize));
}
DavidG
  • 113,891
  • 12
  • 217
  • 223

1 Answers1

0

The proper way of adding parameters to an url in Angular is to use the second options parameter of the http.get("url",options) function. Unfortunatly they don't accept arrays rightaway (there is an open github issue).

However string interpolation like you did should also work. You seem to just have the wrong format. As this is treated very framework specific look at this answer to get the right format for your case.

David B.
  • 695
  • 5
  • 10