(PCC)::[How-to-Display-a-table-with-even-and-odd-in-AngularJS]::[angularjs]
<!DOCTYPE html> <html> <style> table, td { border: 1px solid grey; border-collapse: collapse; padding: 5px; } </style> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <body> <div ng-app="myApp" ng-controller="customersCtrl"> <table> <tr ng-repeat="x in names"> <td ng-if="$odd" style="background-color:#f1f1f1"> {{ x.Name }}</td> <td ng-if="$even"> {{ x.Name }}</td> <td ng-if="$odd" style="background-color:#f1f1f1"> {{ x.Country }}</td> <td ng-if="$even"> {{ 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> </body> </html>
{{ x.Name }} | {{ x.Name }} | {{ x.Country }} | {{ x.Country }} |