Miguel Moura
Miguel Moura

Reputation: 39484

Angular Http Get with parameter

I am calling a service using angular as follows:

return $http.get('api/properties', { params: { id: id } });

In this case the resulting url is:

api/properties?id=2

So I am getting an error because I would need:

api/properties/2

What would be the correct way have this url?

Upvotes: 0

Views: 69

Answers (1)

Icycool
Icycool

Reputation: 7179

sounds silly but concatenate the string will do

$http.get('api/properties/' + id);

Upvotes: 2

Related Questions