一个jsonobject, 希望可以遍历获取key和value, 是否可以用ng-repeat的方式获取,或者别的简单的方式,达到类似以下的效果;
以下jsonobject使用ng-repeat会报错
$scope.data = {'aaa' : '123' , ‘bbb’:'456','ccc':'789'}
<p ng-repeat="m in data">
key = {{m.key}}
value = {{m.value}}
</p>
高洛峰2017-05-15 17:07:43
可以参照一下angular官方对ngRepeat的讲解:
Iterating over object properties
It is possible to get ngRepeat to iterate over the properties of an object using the following syntax:
<p ng-repeat="(key, value) in myObj"> ... </p>