Hello Reader's if you want to get data from another webpage then you have to make ajax hit. Angular JS also provide you to get your data and redesign it into it's script.
Then you can generate the design itself. Let's see it's working example as below:-
<!DOCTYPE html>
<html >
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<tr ng-repeat="x in names">
<td>{{ x.Name }}</td>
<td>{{ x.Country }}</td>
</tr>
</table>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("http://www.w3schools.com/angular/customers_mysql.php")
.then(function (response) {$scope.names = response.data.records;});
});
</script>
</body>
</html>
Here in the code above data is passing through customers_mysql.php page and we have desing it into table.Now the final data on the current page will be nice formated and will be shown in tables.
0 Comment(s)