I'm creating a payment portal where a user creates a paymentPlan for a paymentMethod and numberOfIntallments. The paymentPlan is shown in a table with ng-repeat. The numberOfIntallments can be up to 36 and I don't want the user to see details about all the installments.
What I want to do:
If numberOfIntallments < 7 then show all installments.
If numberOfIntallments >= 7 show the first 2 installments and the last 2 and create a button in the middle of the table to showAll installments.
How can I solve this?
Current code:
<tr ng-repeat="model in paymentPlan.installments">
<td>{{model.dueDate | date: 'shortDate'}}</td>
<td>{{model.principal | currency:undefined:0}}</td>
<td ng-show="numberOfInstallments > 1">{{model.contractInterest | currency:undefined:0}}</td>
<td ng-show="numberOfInstallments > 1">{{model.lendingFee | currency:undefined:0}}</td>
<td ng-show="paymentMethod == 0">{{model.noticeAndPaymentFee | currency:undefined:0}}</td>
<td>{{model.installmentFee | currency:undefined:0}}</td>
<td>{{model.total | currency:undefined:0}}</td>
</tr>