In Angular, to format a currency, use the currency pipe on a number as shown here. <tr *ngFor=”#item of data”> <td><a href=”#”>{{item.invoiceNo}}</a></td> <td>{{item.invoiceDate}}</td> <td>{{item.invoiceStatus}}</td> <td class=”right aligned”>{{item.invoiceTotal | currency:’USD’:true:’1.2-2′}}</td> </tr> The first parameter, ‘USD’, of the pipe is an ISO currency code (e.g. ‘USD’,’EUR’, etc.) The second parameter, true, is an optional boolean to specify whether or […]

Here’s how to get and print the index (or the iteration number) of the current item in an ngFor loop. In Angular, to get the index (or the iteration number) of the current item, add a second part to the ngFor expression (after a semi-colon) as shown here. <tr *ngFor="#item of data; #ndx = index"> […]

Recently, I created a story structure diagram to help me visualize and plan as I work on a novel. There are plenty of story structure diagrams on the web, but I wanted graphic of my own so that I could use layers to overlay my own elements (character arcs, major events, and what-not). LEGEND: Acts, Periods, Events, Points Details […]