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

Description

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

Example


<!--from  ww  w .ja  va  2 s . com-->

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

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities