question: using bindonce and still being able to orderBy
itsgoofer opened this issue · 2 comments
itsgoofer commented
I have a question, I have been playing around with bindonce and I realized it let's me orderBy within ngRepeat based tables. I'm not sure if this is supposed to happen since the data passed to the ngRepeat should be displayed once and unbound.
<tr bindonce ng-repeat="invoice in invoices.all() | orderBy :order:reverse">
<td class="data-cell" bo-text="invoice.invoice_date | date : 'MMM d, y'"></td>
<td class="data-cell" bo-text="invoice.invoice_hash"></td>
<td class="data-cell right" bo-text="invoice.amount_due / 100 | currency"></td>
<td class="data-cell right" bo-text="invoice.paid ? 'Paid' : 'Unpaid'"></td>
</tr>
itsgoofer commented
Any ideas?
gacha commented
You can use filters in controller $filter('orderBy')($scope.invoices.all(), 'order')