top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to fetch the data in AngularJs from a PHP server running MySQL ?

0 votes
400 views
How to fetch the data in AngularJs from a PHP server running MySQL ?
posted Jan 23, 2017 by Navya

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

AngularJS is perfect for displaying data from a Database. Just make sure the data is in JSON format.

<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://xyz.com/angular_mysql.php")
    .then(function (response) {$scope.names = response.data.records;});
});
</script>
answer Jan 27, 2017 by Kavyashree
...