AngularJS版本 : AngularJS v1.4.0-rc.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<!doctype html>
<
html
ng-app
=
"dynamicTemplate"
>
<
head
>
<
script
src
=
"jslib/angular.js"
></
script
>
<
script
type
=
"text/javascript"
>
angular.module('dynamicTemplate', []).controller('PhoneListCtrl',function($scope) {
$scope.phones = [
{
"name": "Nexus S",
"snippet": "Fast just got faster with Nexus S."
},
{
"name": "Motorola XOOM with Wi-Fi",
"snippet": "The Next, Next Generation tablet."
},
{
"name": "MOTOROLA XOOM",
"snippet": "The Next, Next Generation tablet."
}
];
});
</
script
>
</
head
>
<
body
>
<
div
ng-controller
=
"PhoneListCtrl"
>
<
ul
>
<
li
ng-repeat
=
"phone in phones"
>
`phone`.`name`
<
p
>`phone`.`snippet`</
p
>
</
li
>
</
ul
>
<
p
>Total number of phones: `phones`.`length`</
p
>
</
div
>
<
table
>
<
tr
><
th
>row number</
th
></
tr
>
<
tr
ng-repeat
=
"i in [0, 1, 2, 3, 4, 5, 6, 7]"
><
td
>{{'row number : '+(i+1)}}</
td
></
tr
>
</
table
>
</
body
>
</
html
>
|
本文转自 antlove 51CTO博客,原文链接:http://blog.51cto.com/antlove/1651667