2017-01-29 109 views
2

我在模板簡單的離子選擇作爲離子2 ngFor在離子選擇拋出錯誤

<ion-select class="pull-right" [(ngModel)]="selectedLanguage"> 
    <ion-option *ngFor="lang of languages" [value]="lang.name">{{lang.name}}</ion-option> 
</ion-select> 

但其投擲的錯誤:

Unhandled Promise rejection: Template parse errors: Can't bind to 'ngFor' since it isn't a known property of 'ion-option'. 1. If 'ion-option' is an Angular component and it has 'ngFor' input, then verify that it is part of this module. 2. If 'ion-option' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("0>

任何人都知道什麼是錯誤的代碼?

回答

3

let關鍵字丟失,如下圖所示,

*ngFor="let lang of languages" 
+1

謝謝!它的工作現在 – Amal