作用:遍歷數(shù)組
<body ng-app = 'app' ng-controller = 'wmxController'>
<ul>
<!--item可以隨意命名,in是固定寫法,不能改。array是控制器中定義的數(shù)組名稱跌榔,要保持一致-->
<li ng-repeat="item in array"> {{item}} </li>
</ul>
<hr>
<ul>
<li ng-repeat="student in stu"> {{student.name}}----{{student.age}} </li>
</ul>
<script src="angular.js"></script>
<script>
var app = angular.module('app',[]);
app.controller('wmxController',['$scope',function ($scope) {
// 定義一個(gè)全局的數(shù)組名段,名稱為array琼了,這個(gè)數(shù)組中分別有三個(gè)json對象
$scope.array = ['2017年','你好','我喜歡你'];
$scope.stu = [
{name:'xiao',age:18},
{name:'cao',age:20},
{name:'mei',age:22}
];
}])
</script>
</body>