I'm trying to resolve a simple task: dynamically load a component contains a form control. Everything is OK except I get such error:
ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'undefined'. Current value: '[object Object]'. It seems like the view has been created after its parent and its children have been dirty checked. Has it been created in a change detection hook?
I load a component in a canonical way - in ngAfterViewInit
hook with a ComponentFactoryResolver
and a ViewContainerRef
.
I've tried to google about this problem and search here, but I didn't found any clear explanation why it is and how I can fix it.
I'm new in Angular and I might ask questions in a wrong way.
I've prepared an example about it
Thanks in advance!