直接上代码
<!DOCTYPE html><html><head><meta name="description" content="[Ngrepeat in obj and arr]"><script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js"></script> <meta charset = "utf-8"> <title> js bin </ititle> </ad Head> <body> <div ng-app = "myApp"> <div ng-controller = "testctrl"> {{test1}} <div> <rótulo para = "ng-repeat =" ite <p> </p> <Label para = "" ng-repeat = "(chave, value) em obj1"> {{key}}-{{value}} </label> <p> </p> 对于 obj 遍历的话 会根据 的首字母排序 的首字母排序 <Label para = "" ng-repeat = "(key, value) em obj2" {{value.text}} - {{value.Value}} </celt> </div> </div> </div> </body> </html>JS
var app = angular.module('myApp', []);app.controller('testCtrl', function ($scope) { $scope.test1 = 'tt'; $scope.list1 = [{ id: '1', value: 'seti' }, { id: '2', value: 'kuma' }, { id: '3', value: 'cent' }]; $ scope.obj1 = {'1': 'seti', '2': 'kuma', '3': 'cent'}; };});