tag repeat
<div repeat="user in users"></div>
is used to iterate item of array to view , and each dom iterm create byrepeat
will auto create a sub scope for current data.
as attribute:
1 <ANY
2 repeat="user in users">
3 ...
4 </ANY>
@expression xx in yy
Example
1 <div scope="spec.repeat">
2 <ul>
3 <li repeat="lib in frameworks" class="lib"> <span>{{ lib.name }}</span>
4 <ul>
5 <li repeat="user in lib.users" class="user"> <span>{{ user.comp }}</span>
6 <ol>
7 <li repeat="ep in user.emp">{{ep.name}}</li>
8 </ol>
9 </li>
10 </ul>
11 </li>
12 </ul>
13 </div>
1 define('spec.repeat', function (exports,require,module) {
2 exports = module.exports = function () {
3 var m = {
4 frameworks: [{
5 name: "jquery",
6 users: [{
7 comp: "compA",
8 emp: [{
9 name: "a"
10 }, {
11 name: "b"
12 }]
13 }]
14 }, {
15 name: "angularj",
16 users: [{
17 comp: "compB",
18 emp:
19 [{
20 name:
21 "c"
22 },
23 {
24 name:
25 "d"
26 }]
27 }]
28 }]
29 };
30 this.inject(m);
31 };
32 });