AngularJS 表格

前端开发 作者: 2024-08-20 15:40:02
ng-repeat 指令可以完美的显示表格。在表格中显示数据 {{ x.Name }} {{ x.Country }} 使用 CSS 样式为了让页面更加美观,我们可以在页面中使用CSS:使用 orde
<div ng-app="myApp" ng-controller="customersCtrl"> 

table>
  tr ng-repeat="x in names">
    td>{{ x.Name }}</>{{ x.Country }}tr>
>

divscript type="text/javascript" src="js/angular.min.js"></script>
var app = angular.module('myApp,[]);
app.controller(customersCtrlfunction($scope,$http) {
    $http.get("js/text.json)
    .success((response) {$scope.names  response.records;});
});
>
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)  #ffffff}
>
="x in names | orderBy : 'Country'">
>{{ x.Country | uppercase }}>
>{{ $index + 1 }}>
td ng-if="$odd" style="background-color:#f1f1f1"="$even">
原创声明
本站部分文章基于互联网的整理,我们会把真正“有用/优质”的文章整理提供给各位开发者。本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
本文链接:http://www.jiecseo.com/news/show_65589.html
AngularJS 表格