Load Angular2 template from external URL

前端 未结 1 374
无人共我
无人共我 2021-01-12 17:29

Is it possible to load templates from external URLs? This is what I\'m currently trying to do, but Angular seems to be ignoring it without throwing any errors and the page j

1条回答
  •  -上瘾入骨i
    2021-01-12 17:52

    The templateUrl string has to be a compile time constant and is read when pub build is run. Even if it could read from an HTTP url at build time it wouldn't help a bit for

    I'm trying to load different HTML templates depending on the account profile - different accounts will see different HTML templates being served by the Kotlin code.

    Use *ngIf or ngSwitch or dynamically added components instead.

    0 讨论(0)
提交回复
热议问题