-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'createEmbeddedView' of undefined #48
Comments
Any update on this? I'm also experiencing the same issue trying to upgrade a project to Angular 9.x. Thanks. |
@orizens I looked into the issue and it appears to be related to: https://angular.io/guide/migration-dynamic-flag Angular 9 migration @ViewChild('suggestionsTplRef', { read: TemplateRef, static: true })
suggestionsTplRef!: TemplateRef<any>; with ngAfterViewInit() renderTemplate() {
const embeddedViewRef = this.viewContainer.createEmbeddedView(this.suggestionsTplRef);
// prevents change detection errors
embeddedViewRef.detectChanges();
this.cdr.markForCheck();
}
ngOnInit() {
this.filterEnterEvent(this.keydown$);
this.listenAndSuggest(this.keyup$);
this.navigateWithArrows(this.keydown$);
}
ngAfterViewInit() {
this.renderTemplate();
} As I've already performed all of the necessary work for the migration on my fork, I'd suggest this approach which should remain backwards compatible as the final build will keep using the old view engine (as recommended by the Angular Dev team). Please advice and I will make a pull request accordingly. |
hi @SamWolfs thanks for your comment. |
@SamWolfs |
When using Angular 9.0 or above, I receive the following error:
With the following template code:
The text was updated successfully, but these errors were encountered: