【问题标题】:*ngFor doesn't work inside modal (angular 10 ionic 5)*ngFor 在模态中不起作用(角度 10 离子 5)
【发布时间】:2021-02-10 14:14:46
【问题描述】:

我在项目中遇到了一个问题,*ngFor 在模态组件中不起作用,而在其他任何地方都可以使用。我在应用程序组件中导入 BrowserModule,在其他地方导入 commonModule。 没有拼写错误。 我确信声明已明确声明。

错误是:

无法绑定到“ngForOf”,因为它不是“li”的已知属性

有什么帮助吗?

【问题讨论】:

    标签: ngfor ionic5 angular10


    【解决方案1】:

    我刚刚在这个链接中找到了答案: Add the component to your app.module 您应该在根应用程序模块中添加 Modal 组件的位置: 首先在你的app.module中导入Modal页面,

    import {ModalPage} from "./home/modal.page"
    

    然后在声明和 entryComponents 中声明它

    declarations: [AppComponent,ModalPage],
    
    entryComponents: [ModalPage],
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-23
      • 2021-07-02
      • 2019-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多