angularjs ng-class-odd指令
Angularjs實例
為表格的奇數行設置:
<! doctype html> <html> <head> <meta charset =“ utf-8”> <script src =“ http://apps.bdimg.com/lib.com/libs/angular.js/angular.js/1.4.6/angular.min.min.min.js”>背景色:黑色;} </style> </head> <hody ng-app =“ myApp”> <table ng-controller =“ myctrl”> <tr ng-repeat =“ records in Records” ng-class-odd =“ ng-class-odd =”' <td> {{X.country}} </td> </td> </tr> </table> <script> var app = angular.module(“ myApp”,[],[]); app.controller(“ myctrl”,function($ scope) :“ Berglunds snabbk”,“ country”:“瑞典”},{“ name”:“ Centro Moctezuma”,“ country”:“ Mexico”},{“ Name”:“ Ernst Handel”,“ country”,“ countion”,“ actaria”:“ Authia”}}]}})運行結果:
| Alfreds Futterkiste | 德國 |
| Berglunds Snabbk | 瑞典 |
| Centro商業Moctezuma | 墨西哥 |
| 恩斯特·漢德爾 | 奧地利 |
定義和用法
ng-class-odd指令用於為html元素動態的綁定一個或多個css類,但只作用於奇數行。 ,但只作用於奇數行。
ng-class-odd指令需要與ng repeat指令搭配使用。
ng-class-odd指令建議用在表格的樣式渲染中,但是所有html元素都是支持的。
文法
<元素ng-class-odd =“ expression”> </element>
所有html元素都支持。
參數值
| 值 | 描述 |
|---|---|
| 表達 | CSS類。 |
以上就是對angularjs資料的整理,有需要的朋友參考下。 ,有需要的朋友參考下。