angular中的方法ng-repeat的是使用

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="angular-1.5.8.js"></script>
</head>
<body>
<!--//1.0data是一个纯数值的时候:[ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]-->
<!--<div ng-app ng-init="data=[ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]">-->
<!--<div ng-repeat="key in data">-->
<!--<div>{{key}}</div>-->
<!--</div>-->
<!--</div>-->


<!--//2.0data是一个对象的时候:{name:"小明", age:15, sex:"" }-->
<!--<div ng-app ng-init="data={name:'小明', age:15, sex:'' }" >-->
<!--<div ng-repeat="(k,value) in data">-->
<!--<div>{{k}}</div>-->
<!--<div>{{value}}</div>-->
<!--</div>-->
<!--</div>-->
<script>
// 1.0data是一个纯数值的时候:[ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
// 2.0data是一个对象的时候:{name:'小明', age:15, sex:'' }
//ng-repeat:
// 将一个集合( 数组, 键值对 )进行遍历( for遍历, for-in遍历 )
// 一般该指令放在特定的标签中, 凡是使用该指令的标签会被重复的创建, 并填充指定的数据
// 一般使用 的 tr, li, div
//语法:
// ng-repeat=" in 数组 "
// ng-repeat=" ( , ) in 对象 "
// 例如要重复 div
// <div ng-repeat="v in list"></div>
</script>

</body>
</html>
原文地址:https://www.cnblogs.com/liubaichi/p/6051280.html