2016-12-06 86 views
1

首先什麼我想要實現所有的背景下,不知道爲什麼NG重複啓動和NG-重複端拋出異常

<tr ng-repeat-start="eachParam in myArray"> 
    <td rowspan=2>On site</td> 
    <td rowspan="2" class = "success">{{eachParam.support}}</td> 
    <td class = "warning">FE</td> 
</tr> 
<tr> 
    <td class = "warning">BE</td> 
</tr ng-repeat-end> 

我希望它來創建一個結構如下圖所示:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 
 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> 
 

 

 
<table class = "table table-bordered"> 
 
    <tbody> 
 
    <!-- Repeat 1--> 
 
    <tr> 
 
     <td rowspan = 2>super parent1</td> 
 
     <td rowspan = 2>parent1.1</td> 
 
     <td>child 1.1.1</td> 
 
    </tr> 
 
    
 
    <tr> 
 
     <td>child 1.1.2</td> 
 
    </tr> 
 
    <!-- Repeat 2--> 
 
    <tr> 
 
     <td rowspan = 2>super parent2</td> 
 
     <td rowspan = 2>parent2.1</td> 
 
     <td>child 2.1.1</td> 
 
    </tr> 
 
    
 
    <tr> 
 
     <td>child 2.1.2</td> 
 
    </tr> 
 
    </tbody> 
 
</table>

,你可以在這一點,我想用ng-repeat-start和重複這兩個超級父母的片段看,這樣中間<tr>將不會被遺漏,而我不在重複超級父母或父母。

請注意childs是靜態元素。

現在我得到的例外是:

屬性未結束,發現 'NG-重複啓動',但不匹配 'NG-重複,結束' 發現

回答

2

您應該添加ng-repeat-end打開tr標記,而不是結束標記。像這樣:

<tr ng-repeat-start="eachParam in myArray"> 
    <td rowspan=2>On site</td> 
    <td rowspan="2" class = "success">{{eachParam.support}}</td> 
    <td class = "warning">FE</td> 
</tr> 
<tr ng-repeat-end> 
    <td class = "warning">BE</td> 
</tr> 
+0

謝謝兄弟。這確實是需要的。 –