[乐意黎转载]AngularJS快速入门指南08:表格
发布时间:2020-12-17 09:36:14 所属栏目:安全 来源:网络整理
导读:ng-repeat指令非常适合用来显示表格。 在表格中显示数据 在AngularJS中显示表格非常容易: div ng-app ="myApp" ng-controller ="customersCtrl" table tr ng-repeat ="x in names" td {{ x.Name }} / {{ x.Country }} tr div script var app = angular.modu
ng-repeat指令非常适合用来显示表格。 在表格中显示数据在AngularJS中显示表格非常容易: <div ng-app="myApp" ng-controller="customersCtrl"> table> tr ng-repeat="x in names"> td>{{ x.Name }}</>{{ x.Country }}tr> divscript> var app = angular.module('myApp,[]); app.controller(customersCtrlfunction ($scope) { $scope.names [{ "Name: Alfreds FutterkisteCityBerlinCountryGermany },{ Ana Trujillo Emparedados y heladosMéxico D.F.MexicoAntonio Moreno TaqueríaAround the HornLondonUKB's BeveragesBerglunds snabbk?pLule?SwedenBlauer See DelikatessenMannheimBlondel père et filsStrasbourgFranceBólido Comidas preparadasMadridSpainBon app'MarseilleBottom-Dollar MarketseTsawassenCanadaCactus Comidas para llevarBuenos AiresArgentinaCentro comercial MoctezumaChop-suey ChineseBernSwitzerlandComércio MineiroS?o PauloBrazil }]; }); > 运行 加上样式 为了使上面的表格更好看,我们在页面上加上一些CSS: <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; } </style> |
相关内容
- redis-cli中那些或许我们还不知道的一些实用小功能
- 在vim和python virtualenv中带有taglist的ctags
- shell: demo
- [AngularJS面面观] 12. scope中的watch机制---第三种策略$w
- Amazon EC2-ECS Docker容器中芹菜工人的奇怪行为
- 在OS X上找不到bash curl命令。我在哪里可以找到它?
- angularjs ng-grid 表格使用
- twitter-bootstrap – xPages中的bootstrap 3的Eonasdan da
- 如何使用shell检查远程服务器上是否存在文件
- 在scala中trait中使用的抽象值有什么问题吗?