Hi i am trying to figure out,Whether am receiving the data from api or not.Is there anyway to check it?I am totally new to angular.js. My code:
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html">
<title>API Webapp using AngularJS - Not So Clever Demo</title>
<link rel="stylesheet" type="text/css" media="all" href="css/styles.css">
</head>
<body ng-controller="GitHubCtrl">
<p>{{user.results}}<p>;
<script>
function GitHubCtrl($scope, $http) {
$scope.getGitInfo = function () {
$scope.userNotFound = false;
$scope.loaded = false;
$http.get("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=cruise&key=MY_KEY")
.success(function (data) {
$scope.user = data;
console.log(data);
$scope.loaded = true;
})
.error(function () {
$scope.userNotFound = true;
});
}
}
</script>
Please correct me if i did some mistakes.And help me to get this work.I tried using alert to view the data but i was not able to get it.
$scope.getGitInfomethod