ExpressionChangedAfterItHasBeenCheckedError Explained

前端 未结 26 1876
慢半拍i
慢半拍i 2020-11-22 14:46

Please explain to me why I keep getting this error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.

Obviously,

26条回答
  •  孤城傲影
    2020-11-22 15:31

    I'm using ng2-carouselamos (Angular 8 and Bootstrap 4)

    Taking these steps fixed my problem:

    1. Implement AfterViewChecked
    2. Add constructor(private changeDetector : ChangeDetectorRef ) {}
    3. Then ngAfterViewChecked(){ this.changeDetector.detectChanges(); }

提交回复
热议问题