2016-12-09 5 views
5

क्या यह प्राप्त करने के लिए कोणीय दोहराव के लिए संभव है? असल में मैं सोच रहा हूं कि 2 को एक साथ लूप करने का कोई तरीका है? वास्तव में किसी भी मदद की सराहना करते हैं!सूची में एक आइटम के लिए दो कॉलम दोहराने के लिए कैसे करें?

नियंत्रक:

$scope.date=[ 
    {ID:1,Date:'2016-11-12'}, 
    {ID:2,Date:'2016-11-15'}, 
    {ID:3,Date:'2016-12-06'} 
] 

HTML:

<table border="1" align="center"> 
    <tr>    
     <th rowspan="2">ITEMCODE</th> 
     <th rowspan="2">DEBTORCODE</th> 
     <th colspan="2" ng-repeat="d in date">{{d.Date}}</th> 
    </tr>  
    <tr> 
     <th>Bal</th> 
     <th>Order</th> 
    </tr> 
</table> 

और मैं स्तंभ बाल और व्यवस्था प्रत्येक तिथि कॉलम के तहत कंधे से कंधा मिलाकर दोहराया जाएगा चाहते हैं। And I expect the column Bal and Order will repeat side by side

उत्तर

7

आप उपयोग कर सकते हैं एनजी-दोहराने से शुरू और एनजी-दोहराने अंत जो कोणीय में पेश किया गया था 1.2

<th ng-repeat-start="d in date">Bal</th> 
<th ng-repeat-end>Order</th> 

कार्य उदाहरण https://jsfiddle.net/9ve3fu0m/

+0

ओएमजी! यह एक सम्मोहन की तरह काम करता है!!! बहुत बहुत धन्यवाद!!! –

1

आप इस प्रकार का नेस्टेड तालिका का उपयोग कर ऐसा कर सकते हैं:

<table border="1" align="center"> 
<tr> 
    <th rowspan="2">ITEMCODE</th> 
    <th rowspan="2">DEBTORCODE</th> 
    <th colspan="2" ng-repeat="d in date"> 
    <table border="1" > 
     <tr> 
     <th colspan="2">{{d.Date}}</th> 
     </tr> 
     <tr> 
     <th>Bal</th> 
     <th>Order</th> 
     </tr> 
    </table> 
    </th> 
</tr> 
</table> 
+0

Thx यह काम करता है !!! लेकिन इसे सही बनाने के लिए सीएसएस को समायोजित करने की आवश्यकता है! –

0

आप एनजी-दोहराने से शुरू और उपयोग कर सकते हैं एनजी-दोहराने अंत

<table border="1" align="center"> 
<tr>    
    <th rowspan="2">ITEMCODE</th> 
    <th rowspan="2">DEBTORCODE</th> 
    <th colspan="2" ng-repeat="d in date">{{d.Date}}</th> 
</tr>  
<tr> 
    <th ng-repeat-start="d in date">Bal</th> 
    <th ng-repeat-end>Order</th> 
</tr> 

संबंधित मुद्दे