2017-01-29 43 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