Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 未捕获错误:模板分析错误:“let-”仅在ng模板元素上受支持。_Angular_Angular5_Ng2 Bootstrap_Ngx Bootstrap - Fatal编程技术网

Angular 未捕获错误:模板分析错误:“let-”仅在ng模板元素上受支持。

Angular 未捕获错误:模板分析错误:“let-”仅在ng模板元素上受支持。,angular,angular5,ng2-bootstrap,ngx-bootstrap,Angular,Angular5,Ng2 Bootstrap,Ngx 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">{{

我正在将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引导程序,但没有成功。 有人知道,解决这个错误的方法吗?

错误说明了一切。
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)
标记已被放弃,因此您需要在html中将其更改为。错误说明了一切。
该标记已被放弃,因此您需要在html中将其更改为。看起来您正在使用1.9.3版


ngx bootstrap 1.9.3仅支持angular 2和angular 4。请更新到最新版本2.0.2,它将与angular 5配合使用。看起来您正在使用版本1.9.3


ngx bootstrap 1.9.3仅支持angular 2和angular 4。请更新到最新版本2.0.2,angular 5也可以正常工作,使用而不是使用。搜索了很长时间后,我找到了解决方案,将模板替换为ng模板是解决方案之一,但这个问题是因为如果您使用的是与ngx引导不兼容的对等版本,那么这就是一个错误。 上一个容易出错的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引导:^2.0.2, ngx巡回赛:0.0.1

并在app.module.ts中更改以导入TourNgBootstrapModule


在搜索了很长时间后,我找到了解决方案,将模板替换为ng模板是解决方案之一,但这个问题是因为如果您使用的是与ngx引导不兼容的对等版本,那么这是一个错误。 上一个容易出错的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引导:^2.0.2, ngx巡回赛:0.0.1

并在app.module.ts中更改以导入TourNgBootstrapModule


使用ng template而不是template或使用enableLegacyTemplate选项使用ng template而不是template或使用enableLegacyTemplate选项是,但这是/node_modules/ng2 tour/src/lib/plugin/ng bootstrap/tour-step-template.component.js文件中的内容,因此这是唯一使用过它的地方。所以我认为在node_模块中进行更改可能不是正确的方式,这可能是版本相关的问题。是的,但这是/node_模块/ng2 tour/src/lib/plugin/ng bootstrap/tour-step-template.component.js文件中的内容,所以这是唯一使用它的地方。所以我认为在node_模块中进行更改并不是正确的方式,这可能是版本相关的问题。