直接上代码
<! Doctype html> <html> <head> <meta name = "description" content = "[ngrepeat in obj и arr]"> <script src = "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js" charset = "UTF-8"> <Tite> JS BIN </title> </head> <body> <div ng-app = "myApp"> <div ng-controller = "testctrl"> {{test1}} <div> <label for = "" ng-repeat = "in in list1"> {{item. {{item.value}} </label> <p> </p> <label for = "" ng-repeat = "(key, value) в obj1"> {{key}}-{{value}} </label> <p> </p> 对于 obj 遍历的话 会根据 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序 的首字母排序obj2 "> {{key}} - {{value.text}} - {{value.value}} </label> </div> </div> </div> </body> </html>Младший
var app = angular.module ('myApp', []); app.controller ('testctrl', function ($ scope) {$ scope.test1 = 'tt'; $ scope.list1 = [{id: '1', value: 'seti'}, {id: '2', значение: 'kuma'}, {id: '3', vatue: 'at value:' 3 $ scope.obj1 = {'1': 'seti', '2': 'kuma', '3': 'cent'}; };});