Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 对两个不同的对象使用ng repeat start和ng repeat end_Javascript_Angularjs_Loops_Angularjs Ng Repeat - Fatal编程技术网

Javascript 对两个不同的对象使用ng repeat start和ng repeat end

Javascript 对两个不同的对象使用ng repeat start和ng repeat end,javascript,angularjs,loops,angularjs-ng-repeat,Javascript,Angularjs,Loops,Angularjs Ng Repeat,我尝试使用两个不同的对象来表示ng repeat start和ng repeat end 例如: <tr ng-repeat-start="file in files"> <td class="name-col">{{file.name}}<br> </td> <td class="name-col">{{file.

我尝试使用两个不同的对象来表示ng repeat start和ng repeat end

例如:

             <tr ng-repeat-start="file in files">
                <td class="name-col">{{file.name}}<br>
                </td>
                <td class="name-col">{{file.progress}}</td>
              </tr>
              <tr ng-repeat-end="otherFile in otherFiles">
                <td colspan="2">
                  {{otherFile.errors}}
                </td>
              </tr>

{{file.name}}
{{file.progress} {{otherFile.errors}

现在似乎不起作用,它只假设第一个对象(文件)

您的问题是
ng repeat end
不接受参数。 如果您想对上述不同对象执行
ng repeat
,则需要启动一个新的
ng repeat

编辑:添加包装html以显示点。你可能想改变一下

   <div ng-repeat="file in files track by $index">
    <tr>
        <td class="name-col">{{file.name}}<br>
        </td>
        <td class="name-col">{{file.progress}}</td>
      </tr>
      <tr>
        <td colspan="2">
          {{otherFile[$index].errors}}
        </td>
      </tr>
   </div>

{{file.name}}
{{file.progress} {{otherFile[$index].errors}
也许这样可以:

<tr ng-repeat-start="file in files">
            <td class="name-col">{{file.name}}<br>
            </td>
            <td class="name-col">{{file.progress}}</td>
          </tr>
          <tr ng-repeat-end>
            <td colspan="2">
              {{otherFiles[ $index ].errors}}
            </td>
          </tr>

{{file.name}}
{{file.progress} {{otherFiles[$index].errors}
在这种情况下,otherFile如何知道迭代其他文件?你必须在处理html的方式上有所创新,但看看我对我的帖子所做的编辑,我想你能理解要点。@jeremy,它不起作用了?或者这不是你想要的方式?