首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >带有Stepper ExpressionChangedAfterItHasBeenCheckedError Angular 8的ViewChild

带有Stepper ExpressionChangedAfterItHasBeenCheckedError Angular 8的ViewChild
EN

Stack Overflow用户
提问于 2019-12-11 00:48:58
回答 1查看 499关注 0票数 3

我遵循了这个答案:Angular Material Stepper Component For Each Step

代码语言:javascript
复制
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;
EN

回答 1

Stack Overflow用户

发布于 2019-12-11 01:05:23

首先,我必须告诉你,这个错误只在dev模式下抛出。如果你在bootstrapping应用的时候调用enableProdMode(),它不会被抛出。这主要不会发生在dev模式中,因为每次保存之后,angular都会运行它的changeDetection循环,并与它一起仔细检查天气的bindings是否从初始状态发生了变化。

的核心思想:任何改变bindings的东西都需要经历一个changeDetection循环

有关这个问题的更多详细信息,请访问@drew

‘s answer here

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59272002

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档