Curriculum
Course: AngularJS
Login

Curriculum

AngularJS

AngularJS Tutorial

0/65
Text lesson

AngularJS SQL

AngularJS is ideal for presenting data from a database, provided that the data is in JSON format.

Fetching Data From a PHP Server Running MySQL

AngularJS Example

<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(“customers_mysql.php”)
  .then(function (response) {$scope.names = response.data.records;});
});
</script>

Fetching Data From an ASP.NET Server Running SQL

AngularJS Example

<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(“customers_sql.aspx”)
  .then(function (response) {$scope.names = response.data.records;});
});
</script>