zoukankan      html  css  js  c++  java
  • directive ngClassEven & ngClassOdd

      ngClassOdd和ngclassEven指令与ngClass完全相同,除了它们与ngRepeat结合在一起工作,并且只对奇数(偶数)行生效。

      这个指令只能在一个ngRepeat的范围内应用。

    例子:

    index.html

    <!DOCTYPE html>
    <html ng-app="bindExample">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style type="text/css">
            .odd {
                color: red;
            }
            .even {
                color: blue;
            }
        </style>
    </head>
    <body ng-controller="ExampleController">
    <div>
        <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
            <li ng-repeat="name in names">
               <span ng-class-odd="'odd'" ng-class-even="'even'"><!--要用''包括css类名-->
                 {{name}} &nbsp; &nbsp; &nbsp;
               </span>
            </li>
        </ol>
    </div><hr>
    <script src="framework/angular.js"></script>
    <script src="js/bbb.js"></script>
    </body>
    </html>

    script.js

    angular.module('bindExample', [])
        .controller('ExampleController', ['$scope', function($scope) {
            $scope.names = [];
        }]);
  • 相关阅读:
    数组
    灰度转换
    类的定义和头文件
    读文件
    操纵元
    传递引用
    TensorFlow常用函数
    四、Item Pipeline
    三、Scrapy Shell
    二、Scrapy案例入门
  • 原文地址:https://www.cnblogs.com/ms-grf/p/7000814.html
Copyright © 2011-2022 走看看