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
Since ngForIn isn't an attribute directive with an input property of the same name (like ngIf ), Angular then tries to see if it is a (known native) property of the template element, and it isn't, hence the error.
ngFor is not a known property would mean for whatever reason, ngFor cannot be recognized in the application. However, the real problem was that ngFor was recognised but the syntax of ngFor was wrong. Anyway, let's hope Angular team improves their logging in future updates.
Explanation: This error occurs when you use ngIf/ ngFor in the component, where you have not imported CommonModule. Fix: To fix this you have to import the CommonModule in the module file which is used by that HTML file.
It needs to be of
instead of in
*ngFor="let country of countries"
Change
*ngFor="let country in countries"
to
*ngFor="let country of countries"
There is no such thing ngForIn
introduced from Angular side : Ref Link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With