angular - 错误 : Can't bind to 'ngForIn' . Angular 4+

标签 angular angular-template angular4-forms

这个问题已经有人提出了,但不幸的是没有答案对我有用。

这是我的问题( Angular 5):

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

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

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

它不接受 *ngFor in select(我在输入中测试了相同的结果)

我找到了几个答案,例如 commModulebowersModule 需要导入到模块中或放入 b..... 我试图在这里找到解决方案,但没有任何效果。

尽管我的英语很吓人,但我希望你能理解我一点点。 感谢您的回复

最佳答案

它需要是of而不是in

*ngFor="let country of countries" 

关于angular - 错误 : Can't bind to 'ngForIn' . Angular 4+,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47457318/

相关文章:

javascript - 无法使用此嵌套对象数组创建响应式(Reactive)表单

Angular2 测试 : change the injected value of a service

javascript - Angular 表达式 {{::}} 中的两个冒号是什么意思?

html - 从 typescript 调用 CSS 样式将其附加到 html 文件

angular - 如何在 Angular2/4 FormArray 字段中动态设置值?

Angular 2/4 自动完成搜索框

asp.net - Angular 2 无法使用 asp.net MVC 5 Web Api 调用自定义 Web Api

angular - 如何使用 Ionic 4 检测平台

Angular 4 模板错误 : 'anonymous' does not contain such a member

angular - 获取对组件中使用的指令的引用