Skip to content

module structure

Raphaël Balet edited this page Jan 9, 2024 · 4 revisions

my.module.ts

Example on how the module.ts should be structured.

export function MyFactory(_myService: MyService) {
  return async () => await _myService.init()
}

@NgModule({
  imports: [
    CommonModule, // <-- CommunModule, NgIf, NgFor, ... does not need any comments

    // Forms
    FormsModule,
    ReactiveFormsModule,
    MatFormFieldModule,

   // Shared
   SharedModule, // <-- Barrel import
  
   // Components
   StandaloneComponent, // <-- Standalone component first
   ComponentModule,

   // Fragments
 
   // Layouts

   // Modals

   // Pipes
   
   // Services

   // Vendors
  ],
  exports: [
  ],
  providers: [
    { provide: VARIABLE, useValue: `Johndo` },
    AnyService,
    {
      provide: BaseService,
      useExisting: AnyService,
    },
  ],
})

Clone this wiki locally