Angularjs 如何使用md order by在角材料md数据表中给出计算列
我的列是一个计算列,类似于{{desserts.value1/desserts.value2}Angularjs 如何使用md order by在角材料md数据表中给出计算列,angularjs,material-design,Angularjs,Material Design,我的列是一个计算列,类似于{{desserts.value1/desserts.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-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>
甜点(100克)
卡路里
{{sarth.value1}}
{{(sarth.value1==0)?0:sarth.value2}
我想对该列进行排序,所以我应该在md order by中给出什么,通常我可以给出属性名 当我单独给出它的值而没有对象时,它会接受。ie((value1==0)?0:value2)
甜点(100克)
卡路里
{{sarth.value1}}
{{(sarth.value1==0)?0:sarth.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>