-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
@Component({
template: `
<span (click)="onClicked()">{{loading}}</span>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SomeComponent {
public ngOnInit() {
setTimeout(() => this.loading = true, 1000); // needs markForCheck
}
public async onClicked() {
this.loading = true; // fine
await someAsyncStuff();
this.loading = false; // needs markForCheck
}
}Only operates on Components with OnPush strategy. (TBD: what about directives? they could be used everywhere)
Needs to gather all properties used as property binding. Will probably not work for properties used in get accessors and methods.
A lambda that modifies component state needs to have markForCheck.
Async functions that modify the components state after await need markForCheck. Probably requires a control flow graph.