Search code examples
ngforionic5angular10

*ngFor doesn't work inside modal (angular 10 ionic 5)


I faced an issue inside my project, *ngFor doesn't work inside the modal component, and works anywhere else. I import BrowserModule in the app component, and commonModule elsewhere. There is no spelling mistakes. I am sure the declarative is clearly declared.

The error is:

Can't bind to 'ngForOf' since it isn't a known property of 'li'

Any help?


Solution

  • I just found the answer in this link: Add the component to your app.module Where you should add the Modal component in the root app module: First import the Modal page in your app.module,

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

    then declares it inside declarations and entryComponents

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