angular2-changedetection

What does Angular Ivy specifically allow us to do in regards to manual change detection?

浪子不回头ぞ 提交于 2021-02-06 08:58:11
问题 This article mentions that Ivy opens a few possibilities for the future though. It should now be possible to run an application without zone.js, and to semi-manually handle change detection (a bit like you would with React). These APIs already exist but are experimental, not documented, and will probably change in the near future. I think it was already possible to run an application without zone.js prior to Ivy. Does Ivy allow to semi-manually handle change detection? Where are those

What does Angular Ivy specifically allow us to do in regards to manual change detection?

隐身守侯 提交于 2021-02-06 08:57:38
问题 This article mentions that Ivy opens a few possibilities for the future though. It should now be possible to run an application without zone.js, and to semi-manually handle change detection (a bit like you would with React). These APIs already exist but are experimental, not documented, and will probably change in the near future. I think it was already possible to run an application without zone.js prior to Ivy. Does Ivy allow to semi-manually handle change detection? Where are those

Why calling detectChanges() inside component doesn't update values, but wrapping code in setTimeout() does it?

依然范特西╮ 提交于 2020-05-11 05:32:29
问题 I'm trying to automatically select the first value from set of options in <mat-autocomplete ...> export class ExampleComponent implements OnInit, AfterViewInit { @ViewChildren('auto') matAutocomplete: QueryList<any>; constructor(private cdr: ChangeDetectorRef) { } ngAfterViewInit() { this.foundItemsList.changes.subscribe(options => { // ---> This simply works! setTimeout(() => this.matAutocomplete.first._keyManager.setFirstItemActive(), 0); // ---> This doesn't works?! No error shown, it just

Angular2: *ngFor does not update when array is updated

大憨熊 提交于 2020-03-17 10:08:08
问题 I have an array of objects (let's call it arr ). In one of my component's inputs in the (change) method I modify one of these object's attribute, but in the view ( *ngFor ) nothing changes. I read that Angular2 change detection doesn't check the contents of arrays or object, so I tried these: this.arr = this.arr.slice(); and this.arr = [...this.arr]; But the view doesn't change, it still shows the old attribute. In the (change) method with console.log() I got the correct array. Weird, but