【问题标题】:Getting error of <template #innerView> while updating from angular 2 to angular 4从角度 2 更新到角度 4 时出现 <template #innerView> 错误
【发布时间】:2017-11-04 12:30:46
【问题描述】:

enter image description here

我收到错误,因为“模板解析错误:“let-”仅支持 从角度 2 更新到角度 4 时的 ng-template 元素。我 已附上相同的屏幕截图。

【问题讨论】:

  • 添加一些代码来帮助你
  • 应该是&lt;ng-template #innerView&gt;

标签: angular angular2-template updating let


【解决方案1】:

在 Angular 2 中,您可以将 &lt;template&gt; 标签用于 TemplateRefs,但由于这是一个实际的 HTML 标签,因此在 Angular 4 中它已被弃用,取而代之的是 &lt;ng-template&gt;。所以只需更改名称的标签,它应该可以工作。

【讨论】:

  • 但在我的项目中我没有使用
  • 我用过templateUrl。
  • @KushalPatel,不,我的意思是在您的 HTML 文件中,将 替换为
  • 但我没有在任何 html 文件中使用过
  • 可能是您的依赖项之一。
猜你喜欢
  • 1970-01-01
  • 2019-01-18
  • 2018-12-31
  • 2016-04-12
  • 2016-03-22
  • 2017-10-15
  • 2021-06-18
  • 2018-04-17
  • 1970-01-01
相关资源
最近更新 更多