×

Html & Html5

The World's best Software Development Study Portal

AngularJS Tables


  • The ng-repeat directive is used to draw tables in AngularJS.

  • Displaying tables with AngularJS is very easy and simple.

  • The ng-repeat directive is perfect for displaying tables.

  • Let's take an 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.php") .then(function (response) {$scope.names = response.data.records;}); }); </script>


    Output
    Country Name
    India Ram
    china Moe
    USA Dooley