Passing Multiple Parameters from Angular to Rest Service

How to pass multiple parameters from angular 8 to .NET Core API

just try like this

let headers = new HttpHeaders();
headers = headers.append('responseType', 'json');
return this.http.get<number>(`http://localhost:44353/api/AngularTest/${formattedNumber}/${vin}`, {headers: headers});

and you backend code should be like

public class AngularTestController : ControllerBase
public int CheckIfIDExists(int formattedNumber, string vin)
return 0;

How to pass multiple parameters in http GET request in Angular?

Params can be sent:

const params = new HttpParams()
.set('p1', 'one!')
.set('para2', "two");


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

Your code looks good, perhaps you have a cors problem: What is StaticSettings.BASE_URL? http or https? Or a relative url?

Passing multiple parameters (objects) from angular to spring/hilbernate

The problem is that you are passing the team2 as a third parameter for the http.put function, which is taken as options (not for body where you need it).

You should send something like that (and I think this will need some more work also on the backend)

function(team, team2) { 
return this.http.put('/api/tradeTeam/', {teams: [team, team2]})
.map(res => res.json());

See: Angular HTTP Client Docs

How to pass multiple parameters from Angular form to make POST request?

According to your question, if my understanding is correct, You want to pass parameters while making post request.

You can do something like this:

const val = this.form.value;'url', {
first_name: val.first_name,
last_name: val.last_name,
.subscribe(response => {


How to send POST in angular5 with multiple params?

The second argument to is the body of the post request. Just put both values in the body and then get them out of the body on the server.

return"/saveProjectToClient", {
}, {
headers:new HttpHeaders({
'Authorization': this.authService.getToken()

On the server (Springboot)

public class Dto {
private String idPerson;
private String idProject;

public class ExampleController {

public ResponseEntity postController(@RequestBody Dto dto) {
System.out.print("Person Id was: ");
System.out.print("Project Id was: ");

return ResponseEntity.ok(HttpStatus.OK);

How to pass multiple simple parameters from AngularJS to Web API (using $resource)

Ok here's an example where I passed an object from controller to service, and the service uses $resource

var navApp = angular.module('navApp', [

navApp.controller('menuController', [

function ($scope, navSectionList, navGetCategories) {
$scope.navSectionList = navSectionList.query();
$scope.getSectionID = function (event) {
$scope.navGetCategories = navGetCategories

navApp.factory('navSectionList', [
function ($resource) {
return $resource('/api/navigation/section/list', {}, {
query: { method: 'GET', params: {}, isArray: true }

navApp.factory('navGetCategories', [
function ($resource) {
var service = {
getResource: function (sectionID) {
return $resource('/api/navigation/category/' + sectionID, {}, {
query: { method: 'GET', params: {}, isArray: true }
return service;

getSectionID kept passing undefined to navGetCategories.getResource() until I put event into a box [event].

I still don't really know why it wouldn't work without the square brackets, maybe someone else can explain why.

How to send POST with multiple parameters in AngularJS

Here's what I ended up doing:

The web service is as edited above, allowing the JSON object to be sent to it. The code in the controller is as follows:

vm.sendMail = function (form) {
vm.submitted = true;
vm.msg.message = vm.msg.message.replace(/(\r\n|\n|\r|\n\r)/gm, '<br/>');

var sendMessage = new emailService();
.then(function () {
vm.sendSuccess = true;
vm.sendFailed = false;
.catch(function() {
vm.sendSuccess = false;
vm.sendFailed = true;
vm.submitted = false;

The code in the service is as follows:

(function() {
'use strict';

.service('emailService', ['$resource', emailService]);

function emailService($resource) {
return $resource('/api/email');

Thanks for the help, but I really wanted to learn how to do this with the $resource that I'd started out with.

How to pass multiple values to a parameter in a GET API in angular 9+ using http client

You can provide the params like this: