12

this question has already been said but unfortunately no answer worked for me.

Here is my problem (angular 5):

<option 
    *ngFor="let country in countries" 
    [value]="country.id" >
       {{'page.choose_country' | translate}} *
</option>

I have a simple code but it still shows me this error:

Can't bind to 'ngForIn' since it isn't a known property of 'option'.

It does not accept *ngFor in select (I tested in input same result)

I've found several answers like commModule and bowersModule that need to be imported into the module or put b..... I tried to find solutions here, but nothing works.

I hope you've understood me a little bit, despite my scary English. Thank you for your response

mathiasF
  • 267
  • 1
  • 4
  • 14

2 Answers2

40

It needs to be of instead of in

*ngFor="let country of countries" 
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
6

Change

*ngFor="let country in countries" 

to

*ngFor="let country of countries" 

There is no such thing ngForIn introduced from Angular side : Ref Link

Vivek Doshi
  • 56,649
  • 12
  • 110
  • 122