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

标签 html angular npm frontend ngx-bootstrap

我正在尝试让我的前端应用程序 (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)

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

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

...感谢任何帮助

最佳答案

我在从 Angular 4.x.x 升级到 5.x.x 时遇到了这个错误。原始代码为:

<template let-item>

</template>

这在 Angular 4 中运行良好,但在 Angular 5 中失败了。只需使用 ng-template 即可正常工作(无需安装包,无需清理缓存):

<ng-template let-item>

</ng-template>

关于html - "let-"仅在 ng-template 元素上受支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47866158/

相关文章:

unit-testing - Angular 2 - 何时使用注入(inject)功能以及何时不使用它

css - 根据 Angular 条件修改 CSS 类

node.js - 运行-p : command not found

html - 如何在 CSS 中设置颜色的百分比?

javascript - 如何在单击时更改具有一个 id 的多个按钮类?

javascript - 如何在 Angular 6 中显示带有变化字符串的嵌套 JSON 对象

node.js - 我可以强制链接 node@6 吗?

html - 用内容扩展正文

html - 我如何在 CSS/HTML 中几乎是一个合并框的地方复制这个输入文本效果?

javascript - NodeJS 异步系列不按顺序工作