Skip to content

Commit

Permalink
Add trackBy to optimize performance
Browse files Browse the repository at this point in the history
  • Loading branch information
schinken committed Oct 16, 2016
1 parent c614fa0 commit 7a0dd43
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/script/lib/controllers/index/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
<div class="col-xs-12">
<h3 translate>indexActiveUser</h3>
<ul class="user-list clearfix">
<li ng-repeat="user in users | filter:isActiveUser | orderBy:'name'" ng-click="userClick(user.id)" class="col-xs-2 panel panel-default" title="{{user.name}}">
<li ng-repeat="user in users | filter:isActiveUser | orderBy:'name' track by user.id"
ng-click="userClick(user.id)"
class="col-xs-2 panel panel-default"
title="{{user.name}}">
<div class="name">{{user.name}}</div>
<div class="balance" ng-class="user.balance < -0.009 ? 'negative' : ''">{{user.balance | number:2}} {{currency}}</div>
</li>
Expand All @@ -19,7 +22,10 @@ <h3 translate>indexActiveUser</h3>
<div class="col-xs-12">
<h3 translate>indexInactiveUser</h3>
<ul class="user-list clearfix">
<li ng-repeat="user in users | filter:isInactiveUser | orderBy:'name'" ng-click="userClick(user.id)" class="col-xs-2 panel panel-default" title="{{user.name}}">
<li ng-repeat="user in users | filter:isInactiveUser | orderBy:'name' track by user.id"
ng-click="userClick(user.id)"
class="col-xs-2 panel panel-default"
title="{{user.name}}">
<div class="name">{{user.name}}</div>
<div class="balance" ng-class="user.balance < 0 ? 'negative' : ''">{{user.balance | number:2}} {{currency}}</div>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/script/lib/controllers/transaction/transaction.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h2><span translate translate-value-name="{{user.name}}">transactionForUser</spa
</tr>
</thead>
<tbody>
<tr ng-repeat="transaction in transactions | orderBy:'-id'">
<tr ng-repeat="transaction in transactions | orderBy:'-id' track by transaction.id">
<td>{{transaction.createDate | localtime}}</td>
<td class="balance" ng-class="transaction.value < 0 ? 'negative' : ''">{{transaction.value|number:2}} {{currency}}</td>
</tr>
Expand Down

0 comments on commit 7a0dd43

Please sign in to comment.