Angularjs ng-class-aven 指令
angularjs 实例
为表格的偶数行设置 :
<! doctype html> <html> <head> <meta charset = "utf-8"> <script src = "http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"> </script> <style> .Striped {white : white; 배경색 : black;} </style> </head> <body ng-app = "myapp"> <table ng-controller = "myctrl"> <tr ng-repeat = "x in Records"ng-class-even = " 'striped'"> <td> {x.name}} <td> </tr> </table> <cript> var app = angular.module ( "myapp", []); app.controller ( "myctrl", function ($ scope) {$ scope.records = [{ "name": "Alfreds futterkiste", "country": "독일"} : "berglunds snabbk": "" "스웨덴"}, { "이름": "Centro Comercial Moctezuma", "Country": "Mexico"}, { "Name": "Ernst Handel", "Country": "Austria"}}); </script> </body> </html>运行结果 :
| Alfreds Futterkiste | 독일 |
| Berglunds snabbk | 스웨덴 |
| Centro Comercial Moctezuma | 멕시코 |
| Ernst Handel | 오스트리아 |
定义和用法
NG 클래스-비 1 指令用于为 html 元素动态的绑定一个或多个 css 类, 但只作用于偶数行。
ng 클래스-비 指令需要与 ng-repeat 指令搭配使用。
ng 클래스-벤 指令建议用在表格的样式渲染中, 但是所有 html 元素都是支持的。
语法
<요소 ng 클래스-even = "expression"> </element>
html t
参考值 :
| 值 | 描述 |
|---|---|
| 표현 | CSS s |
以上就是对 angularjs ular ular, 后续继续补充, 谢谢大家的支持!