直接上代码
<! doctype html> <html> <head> <meta name = "คำอธิบาย" content = "[ngrepeat ใน obj และ arr]"> <script src = "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3 <title> js bin </title> </head> <body> <div ng-app = "myapp"> <div ng-controller = "testctrl"> {{test1}} <div> <label for = "" ng-repeat = repeat = p สำหรับ = "" ng-repeat = "(key, value) ใน obj1"> {{key}}-{{value}} </label> <p> </p> 对于 obj 遍历的话会根据的首字母排序 <label-}} {{value.value}} </label> </div> </div> </div> </body> </html>JS
var app = angular.module ('myapp', []); app.controller ('testctrl', ฟังก์ชั่น ($ scope) {$ scope.test1 = 'tt'; $ scope.list1 = [{id: '1', ค่า: 'seti'}, {id: '2' $ scope.obj1 = {'1': 'seti', '2': 'kuma', '3': 'cent'}; -