AngularJS Tutorial - Static construct vs ng:repeat, ng:class, ng:class-odd








The following code shows how to do static construct a UL list vs ng:repeat, ng:class, ng:class-odd.

Example


<!--   w ww.  j  a  v  a2 s . c  om-->

<!doctype html>
<html ng-app>
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.js"></script>
</head>
<body>

<ul>
    <li ng:repeat="item in ['a','b','c','d']" ng:class="'ng-class'" ng:class-odd="'ng-class-odd'">{{item}}</li>
</ul>
<hr>
static:
<ul>
    <li class="ng-class ng-class-odd">a</li>
    <li class="ng-class">b</li>
    <li class="ng-class ng-class-odd">c</li>
    <li class="ng-class">d</li>
</ul>
</body>
</html>

The code above is rendered as follows: