So I'm getting into Angular and I've made a succesfull api call which returns objects with a name and a url. To get details of an object I need to do another api call which has the id of the object in it. I'm not sure how to do this.
This is my service to make the api call for the details of the object. the ':id' is where the id of the object has to go in the api link
app.factory('pokemonDetails', ['$http', function($http) {
return $http.get('http://pokeapi.co/api/v2/pokemon/:id')
.success(function(data) {
return data;
})
.error(function(err) {
return err;
});
}]);
I'm not sure if I'm explaining this clearly.
When I go to my url '/pokemon/1', the api has to call 'http://pokeapi.co/api/v2/pokemon/1'.
If I go to my url '/pokemon/2', the api has to call 'http://pokeapi.co/api/v2/pokemon/2' and so on..
(I'm not sure if I need to share other parts of my code, if I do tell me and I'll add them.)