I am dealing with an array of objects and the length is displayed using this code snippet:
<strong *ngIf="cart">{{ cart.length }}</strong>
Even though when I add items to the array, both the array and its length are showing correctly in the console, the view does not update and still shows 0. Here is a snippet from my .ts file:
cart=[];
add = (item) => {
this.cart.push(item);
console.log(this.cart);
console.log(this.cart.length);
}
Your assistance on this issue would be greatly appreciated!