Using http get to retrieve data from remote URL which correspondingly send response which should be in json format.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> <script>
angular.module('myApp',[])
.controller('angController',function($scope,$http) {
$http.get("http://www.w3schools.com/website/Customers_JSON.php")
.success(function(response) {$scope.names = response;});
});
</script>
</head>
<body ng-app="myApp">
<div ng-app="" ng-controller="angController">
<table border=1>
<tr ng-repeat="x in names">
<td></td>
<td></td>
</tr>
</table>
</div>
</body>
</html>
Output of this is code is given below :
No comments:
Post a Comment