编辑下面的代码:【加编码】
<html> <head> <style> table, th , td { border: 1px solid grey; border-collapse: collapse; padding: 5px; } table tr:nth-child(odd) { background-color: #f1f1f1; } table tr:nth-child(even) { background-color: #ffffff; } </style> </head> <body> <div ng-app="" ng-controller="customersController"> <table> <tr ng-repeat="x in names | orderBy : 'Country'"> <td>{{ x.Name }}</td> <td>{{ x.Country }}</td> </tr> </table> </div> <script> function customersController($scope,$http) { $http.get("/try/angularjs/data/Customers_JSON.php") .success(function(response) {$scope.names = response;}); } </script> <script src="https://libs.baidu.com/angular.js/1.2.15/angular.min.js"></script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂