模板解析错误 - >无法绑定到' ngforOf'因为它不是“离子项目”的已知属性。

时间:2017-12-18 03:07:42

标签: angular ionic-framework

我已经从Web服务获取数据,并且在我的html页面中我想呈现这些数据。我使用*ngfor来遍历数据:

<ion-list>
    <ion-item *ngfor="let item of items">
        {{item.Problem}}
    </ion-item>
</ion-list>

但它会返回:

Uncaught Error: Template parse errors:
Can't bind to 'ngforOf' since it isn't a known property of 'ion-item'.
1. If 'ion-item' is an Angular component and it has 'ngforOf' input, then verify that it is part of this module.
2. If 'ion-item' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
    <ion-list>

        <ion-item [ERROR ->]*ngfor="let item of items">

            {{item.Problem}}
"): ng:///AppModule/RedditsPage.html@14:18
Property binding ngforOf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
    <ion-list>

        [ERROR ->]<ion-item *ngfor="let item of items">

            {{item.Problem}}
"): ng:///AppModule/RedditsPage.html@14:8

我已经检查了ngfor语法,如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

应为*ngFor

<ion-item *ngFor="let item of items">