Angular 10, TypeError in browser console, but no error in build

假如想象 提交于 2020-12-14 23:52:50

问题


No code changes done, upgraded to Angular 10, everything works except a feature. There were no build errors, but in browser console able to see below error. I guess this may be related to angular.core, rxjs, but unclear..appreciate your help.

 core.js:4197 ERROR TypeError: templateRef.createEmbeddedView is not a function
    at ViewContainerRef.createEmbeddedView (core.js:10092)
    at NgTemplateOutlet.ngOnChanges (ng_template_outlet.ts:65)
    at NgTemplateOutlet.rememberChangeHistoryAndInvokeOnChangesHook (core.js:2131)
    at callHook (core.js:3042)
    at callHooks (core.js:3008)
    at executeInitAndCheckHooks (core.js:2960)
    at selectIndexInternal (core.js:6179)
    at Module.ɵɵadvance (core.js:6152)


    

回答1:


I found the cause, I had a name for div same as ng-template which was causing the issue, once i renamed "sResult" of the ngtemplate, issue got resolved.

`<div
  class="tree results-container" #sResult >
  <ng-template #sResult let-items>
    <ul>`


来源:https://stackoverflow.com/questions/64902629/angular-10-typeerror-in-browser-console-but-no-error-in-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!