2017-07-25 148 views
0

我就给列计算列角材料MD-数据表就像一个计算列{{desserts.value1/desserts.value2}}如何通过MD-订单

<md-table-container> 
    <table md-table> 
    <thead md-head md-order="myOrder"> 
     <th md-column md-order-by="value1">Dessert (100g serving)</th> 
     <th md-column md-order-by="????">Calories</th> 
    </thead> 
    <tbody md-body> 
     <!-- we can let ng-repeat sort the columns for us --> 
     <tr ng-repeat="dessert in desserts | orderBy: myOrder"> 
     <td>{{ dessert.value1}}</td> 
     <td>{{ (dessert.value1 == 0)?0 : dessert.value2)}}</td> 
    </tr> 
    </tbody> 
    </table> 
</md-table-container> 

我想为了这个列,所以我应该给予md-order-by,通常我可以给出属性名称。

+0

你使用这个[模块](https://github.com/daniel-nagy/md-data-table)? – JeanJacques

+0

是https://github.com/daniel-nagy/md-data-table –

回答

0

当我单独给出它的价值而没有反对意见时,它会花费。即((value1 == 0)?0:value2)

<md-table-container> 
    <table md-table> 
    <thead md-head md-order="myOrder"> 
     <th md-column md-order-by="value1">Dessert (100g serving)</th> 
     <th md-column md-order-by="(value1 == 0)?0 : value2)">Calories</th> 
    </thead> 
    <tbody md-body> 
     <!-- we can let ng-repeat sort the columns for us --> 
     <tr ng-repeat="dessert in desserts | orderBy: myOrder"> 
     <td>{{ dessert.value1}}</td> 
     <td>{{ (dessert.value1 == 0)?0 : dessert.value2)}}</td> 
    </tr> 
    </tbody> 
    </table> 
</md-table-container>