Angularjs ng-class-odd指令
Angularjs实例
为表格的奇数行设置:
<!doctype html> <html> <head> <meta charset = "utf-8"> <script src = "http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"> </scrip>バックグラウンドカラー:black;} </style> </head> <body ng-app = "myApp"> <table ng-controller = "myctrl"> <tr ng-repeat = "x in records" ng-class-odd = "'striped'"> <td> {{x.name}}} </td> <td> {{x.country}} </td> </tr> </table> <script> var app = angular.module( "myapp"、[]); app.controller( "myctrl"、function($ scope){$ scope.records = [{{"" counter ":" " 「Berglunds Snabbk "、" Country ":" Sweden "}、{" name ":" Centro Comercial Moctezuma "、" Country ":" Mexico "}、{" ernst handel ":" country ":" austria "}]}); </body> </html> </html>运行结果:
| Alfreds futterkiste | ドイツ |
| Berglunds Snabbk | スウェーデン |
| Centro Comercial Moctezuma | メキシコ |
| エルンストヘンデル | オーストリア |
定义和用法
ng-class-odd
ng-class-odd
ng-class-odd指令建议用在表格的样式渲染中、但是所有html元素都是支持的。
语法
<要素ng-class-odd = "expression"> </element>
所有HTML元素都支持。
参数值
| 值 | 描述 |
|---|---|
| 表現 | 表达指定一个或多个CSS类。 |
Angularjs资料的整理、有需要的朋友参考下。