I'm sure this is a simple solution but really couldn't find anything online or I kept getting sent down the wrong rabbit holes...
I just want to do a simple loop and add the items to a variable for display purpose only..
<div *ngFor="let item of items">
<div> {{ item.cost }} </div>
<div>
then outside the loop initialize a variable and within the loop and increment it
set totalCost=0
<div *ngFor="let item of items">
<div> {{ item.cost }} </div>
set totalCost = totalCost + item.cost
<div>
so I tried ngInit and various flavors to no avail. such as How do I get the total sum in ng-init and ng-repeat - angularjs
<div (click)="totalcost = totalcost + item.cost">No need to set it to 0 first.