[英]How to use templateUrl from remote server? Angular 2
我有這個組件的文件與遠程URL:
@Component({
templateUrl: '/mobilesiteapp/template/?path=pages/tabs'
})
export class TabsPage {
}
我的編譯器給了我:
[13:28:50] Error reading template file, "/mobilesiteapp/template/?path=pages/tabs": Error: ENOENT: no such file or directory, open 'D:\denwerready\-readyscript
\modules\mobilesiteapp\appsourse\src\pages\mobilesiteapp\template\?path=pages/tabs'
我不需要這個檢查,因為我需要從url獲取模板。
怎么解決? 有人知道嗎?
你的用例是什么?
無法使用遠程模板,您必須擁有模板的本地副本才能使Angular 2編譯器正常工作。
或者,您可以使用ComponentFactoryResolver
並從控制器動態注入模板/組件。
https://blog.thecodecampus.de/angular-2-dynamically-render-components/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.