I have written the code but not getting output. How can I print the output on the page using AngularJS?
When I am using the dynamic URL, the active link color change isn't working.
// Grab path parameters and query parameters
var routeParameters = $routeParams;
$scope.pageParameter = (routeParameters["pageParam"] || "No page parameter");
$scope.queryParameter = (routeParameters["queryParam"] || "No query parameter");
// Do an $http call to your site
$http({
url: "http://keralapsctuts.com/app/index.php",
method: "POST",
data: {
param1: $scope.pageParameter,
param2: $scope.queryParameter
}
}).success(function(response) {
$scope.values = reponse;
});
The response
object represents your HTTP response coming back. I think you should only be assigning the data to you scope values property. So update it like so:
.success(function(response){
$scope.values = reponse.data;
console.log($scope.values); // print to console.
});
If you want to display in the view, @tokkov show how in his answer.
You'd have to reference the values variable within your page template. So something like:
<div ng-repeat="value in values">
A: {{value.a}} B: {{value.b}}
</div>
Obviously the specifics would depend on what the response data looks like and how you want to display it.