angular2 ng-template in a separate file

前端 未结 5 916
孤城傲影
孤城傲影 2021-02-19 09:05

angular2 how to use ng-template from a different file? When I place the ng-template within the same HTML where I use it works but when I move ng-template into a separate file th

5条回答
  •  死守一世寂寞
    2021-02-19 09:45

    If you are loading a separate file, you can define a Component in the separate file (instead of a ). And then inject the entire Component into the using the *ngComponentOutlet.

    You can find the full sulotion with example here: https://stackoverflow.com/a/59180628/2658683

提交回复
热议问题