大佬教程收集整理的这篇文章主要介绍了angularjs – 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)
只需使用template:require(‘./ remote-url.component.html’)而不是templateUrl:’./ remote-url.component.html’,它应该可以正常工作!
以上是大佬教程为你收集整理的angularjs – NgUpgrade:升级Angular1组件时无法使用templateUrl全部内容,希望文章能够帮你解决angularjs – NgUpgrade:升级Angular1组件时无法使用templateUrl所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。