"let-"仅在ng-template元素上受支持

Lei*_*der 10 html frontend npm ngx-bootstrap angular

我试图让我的前端应用程序(Angular5.1.x)运行但由于模板解析错误而停止:

"let-" is only supported on ng-template elements. ("
</thead>
<tbody>
<template ngFor [ngForOf]="rows" [ERROR ->]let-rowz="$implicit" let-    index="index">
<tr *ngIf="!(datePicker.onlyCurrentMonth && rowz[0].sec"):     
ng:///DatepickerModule/DayPickerComponent.html@52:58
    at syntaxError (compiler.js:485)
    at TemplateParser.parse (compiler.js:24633)
    at JitCompiler._parseTemplate (compiler.js:34442)
    at JitCompiler._compileTemplate (compiler.js:34417)
    at compiler.js:34318
    at Set.forEach (<anonymous>)
    at JitCompiler._compileComponents (compiler.js:34318)
    at compiler.js:34188
    at Object.then (compiler.js:474)
    at JitCompiler._compileModuleAndComponents (compiler.js:34187)
Run Code Online (Sandbox Code Playgroud)

我想我需要遵循这个主题问题,说我需要使用ngx-bootrap @ ngx-bootstrap @ 2.0.0-beta.8,但它不适用于那个或v.2.0.0-rc.0

https://github.com/valor-software/ngx-bootstrap/issues/3024

...任何帮助表示赞赏

Ale*_*xei 8

从Angular 4.xx升级到5.xx时遇到此错误原始代码是:

<template let-item>

</template>
Run Code Online (Sandbox Code Playgroud)

这在Angular 4中运行良好,但在5中失败.简单地使用ng-template正常工作(不需要安装软件包,不需要缓存清理):

<ng-template let-item>

</ng-template>
Run Code Online (Sandbox Code Playgroud)


小智 5

ngx-bootstrap 1.x.x使用<template>已在被弃用angular 5.x.x。所以你必须升级到ngx-bootstrap 2.X.X

执行以下升级

npm uninstall --save ngx-bootstrap
npm cache clean -f
npm install --save ngx-bootstrap
Run Code Online (Sandbox Code Playgroud)


小智 4

<template>v2 + 中没有标签,请进行干净安装,检查是否有ngx-bootstrap v2 +检查包锁是否存在