Angular 学习笔记——ng-repeat 隔行换色

<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script type="text/javascript" src="js/angular-1.3.0.js"></script>
    <script>
        var m1 = angular.module('myApp',[]);
        m1.controller('may',['$scope',function($scope){
            $scope.dateList = ["aaaaa" ,"bbbbb" ,"ccccc", "ddddd" ];
        }]);
    </script>
    <style>
    .active1{
        background:red;
    }
    .active2{
        background: green;
    }
    </style>
</head>
<body ng-controller='may'>
    <ul>
        <li class="{{ $even ? 'active1' : 'active2'}}" ng-repeat="data in dateList">{{data}}</li>
    </ul>
    

    <div ng-repeat-start="data in dateList">{{data}}</div>
    <h1>{{data}}</h1>
    <div ng-repeat-end>{{data}}</div>
</body>
</html>

 

posted @ 2015-11-23 23:15  mayufo  阅读(625)  评论(0编辑  收藏  举报