You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The outer tag can differ (e.g. <td> vs <th>), and the model value can differ (e.g. account.closing_balance vs accountType.total vs vm.netWorth), but there is some commonality repeated each time:
General styling (class="amount")
Conditional styling of negative amounts (ng-class="::{'text-danger': x < 0}")
Use of angular's currency filter ({{::x | currency}})
We should consider creating a directive that encapsulates these common traits of currency display to simplify the markup and remove the duplication.
e.g.
<thog-currency="vm.netWorth">Total: </th>
The directive would apply the general & conditional currency styles to the outer tag; and append {{:: x | currency}} to the element's text content (where x is the value passed as the directive attribute).
The text was updated successfully, but these errors were encountered:
(Not to be confused with og-input-currency, which is an input field that accepts/displays currency values).
In a number of views (e.g. 3 x instances in the accounts index alone), we display currency values using markup similar to the following:
The outer tag can differ (e.g.
<td>
vs<th>
), and the model value can differ (e.g.account.closing_balance
vsaccountType.total
vsvm.netWorth
), but there is some commonality repeated each time:class="amount"
)ng-class="::{'text-danger': x < 0}"
)currency
filter ({{::x | currency}}
)We should consider creating a directive that encapsulates these common traits of currency display to simplify the markup and remove the duplication.
e.g.
The directive would apply the general & conditional currency styles to the outer tag; and append
{{:: x | currency}}
to the element's text content (wherex
is the value passed as the directive attribute).The text was updated successfully, but these errors were encountered: