I'm trying to use ViewChild to get a child component's attribute for the Stepper [completed] property, but I can't figure out how to fix the "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'completed: null'. Current value: 'completed: false'".
I followed this answer: Angular Material Stepper Component For Each Step
parent component .ts
@ViewChild(FirstStepComponent, {static: false}) firstStepComp: FirstStepComponent;
get firstStepCompleted() {
return this.firstStepComp ? this.firstStepComp.completed : null;
}
parent component .html
<mat-step [completed]="firstStepCompleted">
<app-first-step>
</app-first-step>
</mat-step>
in the child component .ts
completed: boolean = false;