【问题标题】:Error: Can't bind to 'ngForIn' . Angular 4+错误:无法绑定到 'ngForIn' 。角度 4+
【发布时间】:2018-05-07 12:38:50
【问题描述】:

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

这是我的问题(角度 5):

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

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

无法绑定到“ngForIn”,因为它不是“option”的已知属性。

它不接受 *ngFor 在选择(我在输入相同的结果测试)

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

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

【问题讨论】:

    标签: angular angular-template angular4-forms


    【解决方案1】:

    必须是of 而不是in

    *ngFor="let country of countries" 
    

    【讨论】:

      【解决方案2】:

      改变

      *ngFor="let country in countries" 
      

      *ngFor="let country of countries" 
      

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

      【讨论】:

        猜你喜欢
        • 2018-01-21
        • 2016-04-06
        • 2021-04-26
        • 2016-05-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-02-06
        • 2021-08-11
        相关资源
        最近更新 更多