【问题标题】:Property binding ngForIn not used by any directive on an embedded template - Ionic 2嵌入式模板上的任何指令均未使用属性绑定 ngForIn - Ionic 2
【发布时间】:2016-04-23 00:27:05
【问题描述】:

尝试像这样在 html 中运行 *ngFor。 但是,这个错误出现了。

Property binding ngForIn not used by any directive on an embedded template

这是html代码:

<ion-card *ngFor="#media in medias">

我在之前的项目中也遇到过这种情况,目前仍在解决。有什么线索吗?

Ionic2 和 Angular2 还是新手。

【问题讨论】:

标签: angular ionic2


【解决方案1】:

你误用了 angular1 语法:

而不是*ngFor="#media in medias"

你必须写*ngFor="#media of medias"

更新 - 从 beta.17 开始,使用 let 语法而不是 #。这将更新为以下内容:

<div *ngFor="let media of medias">

https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-04
    • 1970-01-01
    • 2018-11-12
    • 2018-11-18
    • 2018-12-07
    • 2016-11-04
    相关资源
    最近更新 更多