因此,当我将Angular应用程序从7升级到Angular 10后,通过ng serve
为应用程序提供服务时出现以下错误。
ERROR in ./src/app/lizenz-list/lizenz-list.component.html 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
HTML文件如下所示
<ng-template #CRUDTemplatePluginTableCaption>
<div class="ui-g-12 ui-md-6">
<button type="button" style="margin-right: 10px" pButton icon="ui-icon-add"
(click)="addCRUDItem()"></button>
<button type="button" pButton icon="far fa-server" (click)="getServerInfo()"></button>
</div>
</ng-template>
lizenz-list.ts的模板如下所示:
template: `${CRUDBasicListComponent_Template || ''}${LizenzListComponent_Template}`
也许这可能是问题所在?
在Angular 7上,一切正常,我只是找不到问题的答案。
编辑:我正在使用PrimeNg作为UI库。
CRUDBasicListComponent_Template是一个导出的html模板,如下所示:
<p-table [properties etc..]>
<ng-template pTemplate="caption">
<!--Where the ng-Template from Lizenz should be replaced -->
<ng-container *ngTemplateOutlet="CRUDTemplatePluginTableCaption">
</ng-container>
</ng-template>
<ng-template pTemplate="header" let-columns>
<!--HEADER-->
</ng-template>
<ng-template pTemplate="body" let-CRUDItem let-columns="columns">
<!--BODY WITH DATA-->
</ng-template>
</p-table>