0

I am working on a Angular 4 application that uses smartadmin template. I have a popup inside ng-formly.
That popup is rendering a form using repeated section. On popup button click an error is beeing thrown:

'ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'.'

For resolving this I gave detectChanges() method of ChangeDetectorRef in ngAfterViewChecked.
Now, if I click the popup button for the first time, the form is rendering in the popup.
For further button clicks I am getting:

'TypeError: this.formControl.push is not a function' from repeatedSection. repeatedSection is initialising twice from the second time onwards.

Please help me out fixing this issue.

Stack Danny
  • 7,754
  • 2
  • 26
  • 55
Loisy
  • 1
  • Can you repro this on stackblitz.com? – alt255 Apr 10 '19 at 07:02
  • In development mode you get the error `ExpressionChangedAfterItHasBeenCheckedError` as Angular does the changeDetection twice instead of once and checks if the value changed in between. This error wont show up in prod build, but points to possible flaws in how dataflow happens in your page. To debug this issue you have to show the code with your template including this binding and how the value for the same is set in your controller. – sabithpocker Apr 10 '19 at 07:02

0 Answers0