新手初用angular之雙ng-repeat嵌套


<table id="tb_1" cellspacing="0" cellpadding="2" width="100%" border="1">
    <thead>
        <th ng-repeat="hd in headList">{{hd.name}}</th>
    </thead>
    <tbody> 
         <tr ng-repeat="data in tableData">
            <td ng-repeat="hd in headList">
                <input type="text" ng-model="data[hd.code].value" />
            </td>
        </tr> 
     </tbody> 
</table> 

 

兩個ng-repeat當然得有兩個數組對象

var head = [
    {code:"packageCounts"},
    {code:"volume"},
    {code:"volumeUnit"},
]
var tableData = [
    {
        packageCounts:{name:"包裝件數",value:'1'},
        volume:{name:"體積(方)",value:'2'},
        volumeUnit:{name:"體積單價",value:'3'}
    }
]

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM