2016-10-31 32 views

回答

0

讓你的JSON

var jsonData = [ 
        { 
        "bucket": ">120", 
        "productCodes": ["SBML", "SBHL"]     
        }, 
        { 
        "bucket": "1-30", 
        "productCodes": ["SBHL", "SBML", "SBML+"] 
        }, 
        { 
        "bucket": "X", 
        "productCodes": ["SBNL++"] 
        } 
       ]; 

,並查看

<body ng-app="myApp">  
    <div ng-controller="MyCtrl" align="center"> 
     <table border="1"> 
      <tr> 

        <th>Bucket</th> 
        <th>PRODUCT_CODE</th>    
        <th>Allocated #</th>     
      </tr> 
      <tr ng-repeat="p in products"> 

        <td><span>{{p.bucket}}</span></td>          
        <td><span ng-repeat="c in p.productCodes">{{c}}</span></td> 
        <td><span>{{p.productCodes.length}}</span></td>      
      </tr>    
     </table> 
    </div>  
</body> 
</html> 
+0

u能請幫助我作出這樣的JSON ...我試着用下劃線,但不能..也許是我的方法是不正確..但預先感謝。 –