错误:无法绑定到'ngForIn'.Angular 4+

mat*_*asF 7 angular-template angular angular4-forms

这个问题已经说过,但不幸的是没有答案对我有用.

这是我的问题(角5):

<option 
    *ngFor="let country in countries" 
    [value]="country.id" >
       {{'page.choose_country' | translate}} *
</option>
Run Code Online (Sandbox Code Playgroud)

我有一个简单的代码,但它仍然显示我这个错误:

无法绑定到'ngForIn',因为它不是'option'的已知属性.

它不接受select中的*ngFor(我输入相同的结果)

我已经发现了几个类似的答案commModule,并bowersModule需要被导入到模块或把b .....我想在这里找到解决方案,但没有任何工程.

尽管我的英语很可怕,但我希望你能理解我一点点.感谢您的答复

Gün*_*uer 28

它需要of代替in

*ngFor="let country of countries" 
Run Code Online (Sandbox Code Playgroud)


Viv*_*shi 6

改变

*ngFor="let country in countries" 
Run Code Online (Sandbox Code Playgroud)

*ngFor="let country of countries" 
Run Code Online (Sandbox Code Playgroud)

ngForInAngular 方面没有引入这样的东西:Ref Link