After child has been initialised, operation from parent component on child DOM causes ExpressionChangedAfterItHasBeenCheckedError

后端 未结 1 679

I\'d like to make some operation from parent component on child component after child component has been initialised.

Parent:



        
相关标签:
1条回答
  • 2020-12-04 04:50

    you have use detectionChanges for this:

    constructor(private _cd: ChangeDetectorRef){}
    
    ngAfterViewInit() {
          this.childComponent.domMethod('boo');
          this._cd.detectChanges();
    
      }
    
    0 讨论(0)
提交回复
热议问题