2017-12-18 87 views
0

我從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語法已經,如何解決這個問題?

回答

1

應該*ngFor

<ion-item *ngFor="let item of items"> 
相關問題