直接上代码
<! Doctype html> <html> <éadf> <meta name = "Description" content = "[ngrepeat in obj et arr]"> <script src = "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js"> </angular <Title> JS bin </ title> </ head> <body> <div ng-app = "myApp"> <div ng-controller = "testctrl"> {{test1}} <div> <label for = "" ng-repeat = "item dans list1"> {{item.id}} - {{item.value}} pour = "" ng-repeat = "(key, valeur) dans obj1"> {{key}} - {{valeur}} </vabe> <p> </p> 对于 obj 遍历的话 会根据 会根据 key 的首字母排序 <label for = "" ng-repeat = "(key, value) dans obj2"> {{key}} - - {{value. {{value.value}} </ label> </div> </div> </div> </body> </html>Js
var app = angular.module ('myApp', []); app.Controller ('TestCtrl', fonction ($ Scope) {$ scope.test1 = 'tt'; $ scope.list1 = [{id: '1', valeur: 'seti'}, {id: '2', valeur: 'kuma'}, {id: '3', value: Centre: 'Kuma'}, {}, id: '3', valeur: 'Centre']. $ scope.obj1 = {'1': 'seti', '2': 'kuma', '3': 'cent'}; };});