Uncaught Error: Template parse errors: "let-" is only supported on ng-template elements.
Uncaught Error: Template parse errors: "let-" is only supported on ng-template elements.
我正在将我的 angular-cli 项目从 Angular-4 迁移到 Angular-5,但遇到了这个错误,有人知道解决这个错误的任何解决方案吗?
Uncaught Error: Template parse errors:
"let-" is only supported on ng-template elements. ("
<template #tourStep [ERROR ->]let-step="step">
<p class="tour-step-content">{{step?.content}}</p>
<div class="tour-step"): ng:///TourNgBootstrapModule /TourStepTemplateComponent.html@1:24
at syntaxError (compiler.js:466)
我试过安装 ngx-bootstrap,但没有成功。
有人知道解决此错误的方法吗?
错误说明了一切。
标签 <template>
正在被放弃,因此您需要在 html
中将其更改为 <ng-template>
看起来您使用的是 1.9.3 版。
ngx-bootstrap1.9.3只支持angular2和4,请更新至最新版本(2.0.2),与angular5[=10兼容=]
使用<ng-template #tourStep let-step="step"> </ng-template>
代替<template>
找了半天终于找到解决方法,将"template"替换成"ng-template"是解决方法之一,但这个问题是因为你使用的对等版本不兼容[=23] =],则报错。
以前容易出错的package.json是这样的。这就是我解决问题的方法。
{
....
....
"dependencies": {
"@angular/animations": "5.0.4",
"@angular/cdk": "5.0.0-rc.2",
"@angular/common": "5.0.4",
"@angular/compiler": "5.0.4",
"@angular/core": "5.0.4",
"@angular/forms": "5.0.4",
"@angular/http": "5.0.4",
"@angular/material": "5.1.0",
"@angular/platform-browser": "5.0.4",
"@angular/platform-browser-dynamic": "5.0.4",
"ng2-bootstrap": "^1.2.5",
"ng2-tour": "0.1.6",
....
....
}
以下是针对版本的修复,所以我使用了"ngx-bootstrap": "^2.0.2",
"ngx-tour": "0.0.1"
。
{
....
....
"dependencies": {
"@angular/animations": "5.0.4",
"@angular/cdk": "5.0.0-rc.2",
"@angular/common": "5.0.4",
"@angular/compiler": "5.0.4",
"@angular/core": "5.0.4",
"@angular/forms": "5.0.4",
"@angular/http": "5.0.4",
"@angular/material": "5.1.0",
"@angular/platform-browser": "5.0.4",
"@angular/platform-browser-dynamic": "5.0.4",
"ngx-bootstrap": "^2.0.2",
"ngx-tour": "0.0.1,
....
....
}
并更改 app.module.ts 以导入 TourNgBootstrapModule
。
`import {TourNgBootstrapModule} from 'ngx-tour-ng-bootstrap';`
我正在将我的 angular-cli 项目从 Angular-4 迁移到 Angular-5,但遇到了这个错误,有人知道解决这个错误的任何解决方案吗?
Uncaught Error: Template parse errors:
"let-" is only supported on ng-template elements. ("
<template #tourStep [ERROR ->]let-step="step">
<p class="tour-step-content">{{step?.content}}</p>
<div class="tour-step"): ng:///TourNgBootstrapModule /TourStepTemplateComponent.html@1:24
at syntaxError (compiler.js:466)
我试过安装 ngx-bootstrap,但没有成功。 有人知道解决此错误的方法吗?
错误说明了一切。
标签 <template>
正在被放弃,因此您需要在 html
<ng-template>
看起来您使用的是 1.9.3 版。
ngx-bootstrap1.9.3只支持angular2和4,请更新至最新版本(2.0.2),与angular5[=10兼容=]
使用<ng-template #tourStep let-step="step"> </ng-template>
代替<template>
找了半天终于找到解决方法,将"template"替换成"ng-template"是解决方法之一,但这个问题是因为你使用的对等版本不兼容[=23] =],则报错。 以前容易出错的package.json是这样的。这就是我解决问题的方法。
{
....
....
"dependencies": {
"@angular/animations": "5.0.4",
"@angular/cdk": "5.0.0-rc.2",
"@angular/common": "5.0.4",
"@angular/compiler": "5.0.4",
"@angular/core": "5.0.4",
"@angular/forms": "5.0.4",
"@angular/http": "5.0.4",
"@angular/material": "5.1.0",
"@angular/platform-browser": "5.0.4",
"@angular/platform-browser-dynamic": "5.0.4",
"ng2-bootstrap": "^1.2.5",
"ng2-tour": "0.1.6",
....
....
}
以下是针对版本的修复,所以我使用了"ngx-bootstrap": "^2.0.2",
"ngx-tour": "0.0.1"
。
{
....
....
"dependencies": {
"@angular/animations": "5.0.4",
"@angular/cdk": "5.0.0-rc.2",
"@angular/common": "5.0.4",
"@angular/compiler": "5.0.4",
"@angular/core": "5.0.4",
"@angular/forms": "5.0.4",
"@angular/http": "5.0.4",
"@angular/material": "5.1.0",
"@angular/platform-browser": "5.0.4",
"@angular/platform-browser-dynamic": "5.0.4",
"ngx-bootstrap": "^2.0.2",
"ngx-tour": "0.0.1,
....
....
}
并更改 app.module.ts 以导入 TourNgBootstrapModule
。
`import {TourNgBootstrapModule} from 'ngx-tour-ng-bootstrap';`