-1

我正在尝试在另一个重复中创建一个 ng-repeat,如下所示:

模板:

        <fieldset ng-repeat="fieldset in fieldsets">
            {{fieldset}}
            <div class="pair" ng-repeat="field in fields">
                {{field}}
            </div>
        </fieldset>

杰森:

$scope.fieldsets =
[
    {
        fields: [
            'tada',
            'tada'
        ],

    },
"fieldset2"];

得到{{fieldset}}输出,如下所示:

<fieldset>
   {"fields":["tada","tada"]}
</fieldset>
<fieldset>
   fieldset2
</fieldset>
4

1 回答 1

2

很简单,改成这样:

<fieldset ng-repeat="fieldset in fieldsets">
    {{fieldset}}
    <div class="pair" ng-repeat="field in fieldset.fields">
         {{field}}
    </div>
</fieldset>

Plnk:http ://plnkr.co/edit/ytBGgP?p=preview

于 2013-09-12T09:35:00.573 回答