angularjs – NgUpgrade:升级Angular1组件时无法使用templateUr
发布时间:2020-12-17 07:30:21 所属栏目:安全 来源:网络整理
导读:我想升级ng2组件以在ng2组件中使用. 如果我只使用模板字符串ng1组件,要升级,它的工作原理.但是,如果我切换到使用templateUrl,应用程序崩溃并给我这个错误: angular.js:13920 Error: loading directive templates asynchronously is not supportedat RemoteU
我想升级ng2组件以在ng2组件中使用.
如果我只使用模板字符串ng1组件,要升级,它的工作原理.但是,如果我切换到使用templateUrl,应用程序崩溃并给我这个错误: angular.js:13920 Error: loading directive templates asynchronously is not supported at RemoteUrlComponent.UpgradeComponent.compileTemplate (upgrade-static.umd.js:720) at RemoteUrlComponent.UpgradeComponent (upgrade-static.umd.js:521) at new RemoteUrlComponent (remote-url.component.ts:11) at new Wrapper_RemoteUrlComponent (wrapper.ngfactory.js:7) at View_AppComponent1.createInternal (component.ngfactory.js:73) at View_AppComponent1.AppView.create (core.umd.js:12262) at TemplateRef_.createEmbeddedView (core.umd.js:9320) at ViewContainerRef_.createEmbeddedView (core.umd.js:9552) at eval (common.umd.js:1670) at DefaultIterableDiffer.forEachOperation (core.umd.js:4653) 这是一个证明我的问题的插件: https://plnkr.co/edit/2fXvfc?p=info 我跟着Angular 1 – > 2升级指南似乎这个代码应该工作.我不太清楚为什么它不起作用.
我找到了一个非常便宜的解决方案.
只需使用template:require(‘./ remote-url.component.html’)而不是templateUrl:’./ remote-url.component.html’,它应该可以正常工作! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- shell 学习十九天---文本块排序
- shell – 如何在Jenkins控制台输出中隐藏密码?
- 如何避免SSH Secure Shell Client连接Linux超时,自动断开?
- label – 自定义工具提示内容@ ngx-charts | Angular2 |打字
- Bootstrap中回车会触发其他按钮的Dropdown事件的解决方法
- Swagger / OpenAPI:如何在构建过程中集成typescript / ang
- 如何将vim用作’git log’编辑器?
- 通用 WebService 的调用方法 SOAP3.0支持需要
- CXF 入门: 远程接口调用
- scala – 惯用的“get or else update”为immutable.Map?