angularJs 怎么实现 数字方式的 for 循环
展开全部
用原生的for就可以啊,angularJs里面有个angular.forEach,你可以试试
<!DOCTYPE html>
<html ng-app="test">
<head>
<title>angularJs-forEach</title>
</head>
<body>
<div ng-controller="ForEachCtrl">{{text}}</div>
<script type="text/javascript" src="../js/angular.min.js"></script>
<script type="text/javascript">
var test = angular.module('test', []);
test.controller('ForEachCtrl', function($scope){
var arr = ['A', 'B', 'C'],
text = [];
angular.forEach(arr, function(value, key) {
this.push(key+ ":" + value);
}, text);
$scope.text = text.join(' ')
})
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询