直接上代码
<! DocType html> <html> <head> <meta name = "Beschreibung" content = "[nGrepeat in OBJ und arr]"> <script src = "https://cdnjs.cloudflare.com/ajax/libs/angular.js/14/angular.min.js" <title>JS Bin</title></head><body> <div ng-app="myApp"> <div ng-controller="testCtrl">{{test1}} <div> <label for="" ng-repeat="item in list1">{{item.id}} -- {{item.value}}</label> <p></p> <label for="" ng-repeat="(key, value) in obj1">{{key}} -- {{value}}</label> <p> </p> 对于obj遍历的话 会根据key的首字母排序 <label for="" ng-repeat="(key, value) in obj2"> {{key}} -- {{value.text}} -- {{value.value}} </label> </div> </div> </div> </body> </html>JS
var app = angular.module ('myapp', []); app.controller ('testctrl', function ($ scope) {$ scope.test1 = 'tt'; $ scope.obj1 = {'1': 'seti', '2': 'kuma', '3': 'Cent'}; };});