AngularJS-repeat指令

时间:2021-07-18 05:00:37
<body ng-app="myApp">
<div ng-controller="myCtrl">
<ul>
<li ng-repeat="per in data">
<span>姓名:{{per.name}}</span>
<span>姓名:{{per.sex}}</span>
<span>姓名:{{per.age}}</span>
</li>
</ul>
</div>
<script>
var app = angular.module('myApp', []);
app.controller("myCtrl", ['$scope', function (scope) {
scope.data = [
{'name': 'handsome', 'sex': '男', 'age': 21},
{'name': 'handsome', 'sex': '男', 'age': 21},
{'name': 'handsome', 'sex': '男', 'age': 21},
{'name': 'handsome', 'sex': '男', 'age': 21},
];
}]);
</script>
</body>