×

Html & Html5

The World's best Software Development Study Portal

AngularJS SQL


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



Fetching Data From a PHP Server Running MySQL

<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

<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>



Keypoints



  • AngularJS SQL Database data will be in JSON format.

  • CRUD operations Insert, Update, Read and Delete operations in Database are performed with AngularJS SQL.