Here is a function that takes a description variable as a parameter
$scope.relsingle = function(description) {
console.log(description);
var url = $scope.url+'/api/descrelation?limit=4&description='+description;
$http.get(url).success(function(data) {
console.log(data);
$scope.apgresponse = data;
})
};
When passing the value in the HTML page, I use the approach below
ng-init="relsingle(prodres[0].description)"
The value of prodres[0].description is obtained from https://i.sstatic.net/pErk3.png
The value of prodres is obtained from the following function
$scope.prodat = function(id) {
var uri = $scope.url+'/api/getproduct?productid='+id;
console.log(uri);
$http.get(uri).success(function(data) {
console.log(id);
console.log(data);
$scope.prodres = data;
})
};
When logging the value of description in the console within the relsingle function.
console.log(description);
It shows that the value is undefined.