• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

模板解析错误 – >无法绑定到’ngforOf’,因为它不是’ion-item’的已知属性

angular 来源:user3001046 8次浏览

我从web服务已经和我的html页面中获取数据我想呈现此数据。我用*ngfor遍历数据:模板解析错误 – >无法绑定到’ngforOf’,因为它不是’ion-item’的已知属性

<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/[email protected]: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/[email protected]:8 

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

===========解决方案如下:

应该*ngFor

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

版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)