我想升级要在ng2组件内使用的ng1组件。NgUpgrade:升级Angular1组件时无法使用templateUrl
如果我只使用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
我跟着角1 - > 2升级指南,似乎这个代码应该工作。我不太确定它为什么不起作用。
我试过你的方法,但我得到这个错误,而不是:您即将从您的角度指令升级,例如templateUrls的 '未捕获的ReferenceError:要求未在VM586 remoting-定义 url.component.js:8' – Houa
要使用'require'you必须使用正确的模块加载程序,在这种情况下,我认为使用commonJS的更多细节.. https://stackoverflow.com/questions/19059580/client-on-node-uncaught-referenceerror-需要 - 是 - 不定义 – Florian