Why for module login component

Hi, I have an app with login screen ,chat screen and chat details screen, I have one app.module.ts and also I created a module for login and chat screen but not for chat details screen, and my app is working fine without issues, but why I need to create modules for components(login and chat screen but not for chat details screen). I have already one main module(app.module.ts). So please give an explanation.

You don’t need to create separate modules for each component, which I guess is the answer to your question.

That’s right. You do not need extra module when creating new page/component. It is just because when you generate page with Ionic CLI, it will generate module.ts for you for your newly created page for lazy loading purpose. If your component or page has Ionic CLI generated module.ts, you can use that to lazy load your page/component from your app-routing.ts file.

Using this kind of syntax:

const routes: Routes = [
 {
    path: '',
    loadChildren: () =>
      import('src/app/page1/page1.module').then((mod) => mod.Page1Module)
  }
]

Hopefully this explains and clarifies why there is the extra module.ts file.