In my angular4 app i have a component with a *ngFor directive based in a array:
<div *ngFor="let person of persons">
{{person.name}}
{{person.car}}
</div>
In the other part of the component im able to delete a car, so in the subscribe of the deleteCar() method i update the persons array to:
deleteCar(car) {
this.carService.deleteCar(car).subscribe(() => {
this.persons.filter(obj => obj.car == car.name)
.forEach(i => i.car = null);
}
}
The problem is that the *ngFor loop is not triggered when i modify a existing person object in the persons array. How to solve this?