码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-11-24 01:01:44      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:

<!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>

 

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

标签:

原文地址:http://www.cnblogs.com/mayufo/p/4990047.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!