1. 程式人生 > >解決 ng-zorro控制元件 tplModal 報錯Error: ExpressionChangedAfterItHasBeenCheckedError

解決 ng-zorro控制元件 tplModal 報錯Error: ExpressionChangedAfterItHasBeenCheckedError

開發十年,就只剩下這套架構體系了! >>>   

報錯資訊

ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngIf: undefined'. Current value:...

 

解決辦吧 將相關語句包裹在setTimeout裡 ,例如

 setTimeout(() => {

      this.createTplModal(this.tplTitle, this.tplContent, this.tplFooter);


    }, 300);