我遵循了这个答案: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;发布于 2019-12-11 01:05:23
首先,我必须告诉你,这个错误只在dev模式下抛出。如果你在bootstrapping应用的时候调用enableProdMode(),它不会被抛出。这主要不会发生在dev模式中,因为每次保存之后,angular都会运行它的changeDetection循环,并与它一起仔细检查天气的bindings是否从初始状态发生了变化。
的核心思想:任何改变bindings的东西都需要经历一个changeDetection循环
有关这个问题的更多详细信息,请访问@drew
‘s answer here。
https://stackoverflow.com/questions/59272002
复制相似问题