【发布时间】:2016-12-05 05:20:29
【问题描述】:
是否可以从外部 URL 加载模板? 这是我目前正在尝试做的事情,但 Angular 似乎忽略了它而没有抛出任何错误,并且页面只是无限期地继续加载。
@Component(
selector: 'dashboard-page',
//templateUrl: '../templates/dashboard-page.html',
templateUrl: 'http://localhost:9091/html/dashboard-page.html',
directives: const [],
pipes: const []
)
class DashboardPage implements AfterContentInit {
http://localhost:9091/html/dashboard-page.html 我可以直接访问,并且 CORS 已设置为允许端口 8080 上的 Dart 应用程序与端口 9091 上的 Kotlin 应用程序通信。
我正在尝试根据帐户配置文件加载不同的 HTML 模板 - 不同的帐户会看到 Kotlin 代码提供不同的 HTML 模板。
这是 Angular2 加载外部模板文件可以做还是不能做的事情?
【问题讨论】:
-
为什么不使用两个不同的组件,或者一个
ngSwitch?从另一个应用程序提供它似乎过于复杂了。