我正在尝试在另一个重复内部创建一个ng-repeat:
模板:
<fieldset ng-repeat="fieldset in fieldsets">
{{fieldset}}
<div class="pair" ng-repeat="field in fields">
{{field}}
</div>
</fieldset>
JSON:
$scope.fieldsets =
[
{
fields: [
'tada',
'tada'
],
},
"fieldset2"];
{{fieldset}}
得到的输出,如下:
<fieldset>
{"fields":["tada","tada"]}
</fieldset>
<fieldset>
fieldset2
</fieldset>
答案 0 :(得分:2)
很简单,就这样改变:
<fieldset ng-repeat="fieldset in fieldsets">
{{fieldset}}
<div class="pair" ng-repeat="field in fieldset.fields">
{{field}}
</div>
</fieldset>