AngularJS Get Data from Server
AngularJS Get Example
The $http service is a core Angular service that provide the facility to communication with the remote HTTP servers via the browser's XMLHttpRequest object. See the following example below.
HTMl for get
<!DOCTYPE html> <html> <head> <script src = "http://www.ptutorial.com/angularjs/ angular.min.js"></script> <style> table, th, td { border: 1px solid black; border-collapse: collapse; } th, td { padding: 15px; } </style> </head> <body> <div ng-app="ukApp" ng-controller="ukController"> <table> <tr> <th>Name</th> <th>City</th> </tr> <tr ng-repeat="x in names"> <td>{{ x.Name }}</td> <td>{{ x.City }}</td> </tr> </table> </div> </body> </html>
AngularJS get json data Example
<script> var app = angular.module('ukApp', []); app.controller('ukController', function($scope, $http) { $http.get("data.php") .success(function (response) {$scope.names = response.records;}); }); </script>
See Also
Java program to find palindrome string
|
How to install node.js on windows
|
Php object oriented programming