myApp.controller('consumeProduct', function($scope, $http, $log) {
$http({
method: 'GET',
url: 'http://localhost:8080/Products'
}).then(function(response) {
$scope.products = response.data;
$log.info(response);
});
});
I have a controller above that consumes and returns all products from my rest api. Now I would like to create another controller that takes a parameter(a string) and try to use this parameter and consume this web service('http://localhost:8080/Products/ProductName/parameter'. Based on what the parameter is, the service should return a specific product. How would I be able to do this? I'm trying to create a services javascript file to consume all of my rest api resources. Thanks.