I know this is a frequent question, but this is more related to Angular 5. From what I remember this used to work in Angular 2, unless I specify
changeDetection: ChangeDetectionStrategy.OnPush
Code:
addFruit(food) {
// this is not working
this.fruits.push(food);
// this works
// this.fruits = [...this.fruits, food];
}
Did something changed in Angular 5+ that the first method is no longer working?
Working example: https://stackblitz.com/edit/angular-ch-detec?file=app%2Fapp.component.ts