0

そのため、changeDectector.detectChanges() を呼び出す必要があるいくつかのアニメーションを含むカスタム コンポーネントがあります。

私のchildComponent.tsから:

public onLoad(): void {
  this.startAnimations()
}

private startAnimations(): void {
  //.. some animations
  this.changeDetector.detectChanges()
}

これは、次のように ngif を親コンポーネントに追加するまで機能していました。

<StackLayout *ngIf="isReady">
  <ChildComponent></ChildComponent>
</StackLayout>

ngif を追加すると、何らかの理由で childComponent が onLoad multipleTimes を呼び出す原因になります。したがって、this.changeDetector.detectChanges() を呼び出すたびに、onLoad メソッドがトリガーされ、「最大コール スタック サイズを超えました」というエラーが発生します。ここで何が起こっているか知っている人はいますか?どうすれば修正できますか?

よろしくお願いします!

4

0 に答える 0