【问题标题】:ngu-carousel :: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checkedngu-carousel :: ExpressionChangedAfterItHasBeenCheckedError: 表达式在检查后已更改
【发布时间】:2019-02-19 20:36:43
【问题描述】:

我指的是这个例子 https://stackblitz.com/edit/ngu-carousel-ng6?embed=1&file=src/app/app.component.html

但在控制台中,我收到此错误

错误:ExpressionChangedAfterItHasBeenCheckedError:表达式有 检查后改了。以前的值:'ngForOf:'。当前的 值:'ngForOf:0,1,2,3,4,5'。

【问题讨论】:

    标签: javascript angular typescript angular6


    【解决方案1】:

    Here 是解决您问题的方法

    您可以使用 ChangeDetectionStrategy

    喜欢,

    import { Component, ChangeDetectionStrategy } from '@angular/core';
    
        @Component({
          changeDetection: ChangeDetectionStrategy.OnPush,
          selector: 'my-app',
          templateUrl: './app.component.html',
          styleUrls: ['./app.component.css']
        })
    

    【讨论】:

      猜你喜欢
      • 2018-10-23
      • 2021-09-15
      • 2017-10-19
      • 2018-11-06
      • 2018-04-22
      • 1970-01-01
      • 1970-01-01
      • 2018-05-10
      • 2018-06-17
      相关资源
      最近更新 更多