-1

I am trying to do a get request to recover data from the server using the following url:

url = /api/projects/:projectId/scenarios

How can I do that using $http.get in AdngularJS?.

Adrian Espinoza
  • 73
  • 2
  • 10
  • Hum... `$http.get(url)`? [The documentation](https://docs.angularjs.org/api/ng/service/$http), if needed. – Blackhole May 14 '14 at 15:08
  • I would like to build a get request something like this: $http.get('api/projects/:projectId/scenarios'), my question is wath happen with :projectId how can I pass this? – Adrian Espinoza May 14 '14 at 15:14

1 Answers1

0

you might want to take a look at Restangular, I like its notation more than standard angularjs $http or $resource.

Restangular.setBaseURL('/api/');
Restangular.one('projects', projectId).all('scenarios').getList().then(function(data) {
   myVariable = data;
});

Restangular

EasterBunnyBugSmasher
  • 1,507
  • 2
  • 15
  • 34