I am facing an issue with my array variable that contains objects. Here is an example of how it looks:
[{name: 'Name 1', price: '10$'}, {name: 'Name 2', price: '20$'}, ...]
In my view, I have a list of products being printed out like this:
<div *ngFor="let item of items">
{{item.name}} - {{item.price}}
</div>
Even if I change the 'items' array in the code due to an external event, the variable updates but the view does not refresh.
How can I resolve this issue?
Edit:
The function changeArray() only consists of one line:
changeArray(items) : void{
this.items = items;
}
I suspect that the problem lies in calling this method from another component. For instance, in component 'B', I have a line similar to this:
a.changeArray(items);