Amal
Amal

Reputation: 545

ionic 2 ngFor on ion-option throwing error

I have simple ion-select in template as

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

But its throwing error:

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>

anyone have idea what is wrong with the code?

Upvotes: 3

Views: 2664

Answers (1)

micronyks
micronyks

Reputation: 55443

let key word is missing as shown below,

*ngFor="let lang of languages"

Upvotes: 4

Related Questions