src/app/app.module.ts
Main entry point of the application. Imports required modules and does basic setup. Real functionality should be implemented in separate modules and imported here rather than being part of this module.
AdminModule
ApplicationLoadingComponent
AttendanceModule
BirthdayDashboardWidgetModule
BulkEditModule
ChangeHistoryModule
ChildrenModule
ConfigurableEnumModule
CoreModule
DashboardModule
DeDuplicationModule
DemoDataModule
EmailClientServiceModule
EntityCountDashboardWidgetModule
FileModule
ImportModule
LanguageModule
LatestChangesModule
LocationModule
MarkdownPageModule
MatchingEntitiesModule
NotesModule
PermissionsModule
ProgressDashboardWidgetModule
PublicFormModule
ReportingModule
SessionModule
ShortcutDashboardWidgetModule
SkillModule
TemplateExportModule
TodosModule
UiComponent
AppComponent
AnalyticsService
DateAdapterWithFormatting
KeycloakAdminService
NotificationService
/*
* This file is part of ndb-core.
*
* ndb-core is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ndb-core is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ndb-core. If not, see <http://www.gnu.org/licenses/>.
*/
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import {
LOCALE_ID,
NgModule,
inject,
provideZoneChangeDetection,
} from "@angular/core";
import {
provideHttpClient,
withInterceptorsFromDi,
withXhr,
} from "@angular/common/http";
import { AppComponent } from "./app.component";
import { allRoutes } from "./app.routing";
import { SessionModule } from "./core/session/session.module";
import { LatestChangesModule } from "./core/ui/latest-changes/latest-changes.module";
import { ChildrenModule } from "./child-dev-project/children/children.module";
import {
ServiceWorkerModule,
SwRegistrationOptions,
} from "@angular/service-worker";
import { environment } from "../environments/environment";
import { AnalyticsService } from "./core/analytics/analytics.service";
import { ConfigurableEnumModule } from "./core/basic-datatypes/configurable-enum/configurable-enum.module";
import { FaIconLibrary } from "@fortawesome/angular-fontawesome";
import { fas } from "@fortawesome/free-solid-svg-icons";
import { far } from "@fortawesome/free-regular-svg-icons";
import { Angulartics2Matomo, Angulartics2Module } from "angulartics2";
import {
DEFAULT_LANGUAGE,
LANGUAGE_LOCAL_STORAGE_KEY,
} from "./core/language/language-statics";
import { DateAdapter, MAT_DATE_FORMATS } from "@angular/material/core";
import {
DATE_FORMATS,
DateAdapterWithFormatting,
} from "./core/language/date-adapter-with-formatting";
import { FileModule } from "./features/file/file.module";
import { LocationModule } from "./features/location/location.module";
import { LanguageModule } from "./core/language/language.module";
import { PermissionsModule } from "./core/permissions/permissions.module";
import { UiComponent } from "./core/ui/ui/ui.component";
import { MatSnackBarModule } from "@angular/material/snack-bar";
import { MatDialogModule } from "@angular/material/dialog";
import { componentRegistry, ComponentRegistry } from "./dynamic-components";
import { DashboardModule } from "./core/dashboard/dashboard.module";
import { CoreModule } from "./core/core.module";
import {
entityRegistry,
EntityRegistry,
} from "./core/entity/database-entity.decorator";
import {
LOCATION_TOKEN,
NAVIGATOR_TOKEN,
WINDOW_TOKEN,
} from "./utils/di-tokens";
import { AttendanceModule } from "#src/app/features/attendance/attendance.module";
import { NotesModule } from "./child-dev-project/notes/notes.module";
import { MatchingEntitiesModule } from "./features/matching-entities/matching-entities.module";
import { ProgressDashboardWidgetModule } from "./features/dashboard-widgets/progress-dashboard-widget/progress-dashboard-widget.module";
import { ReportingModule } from "./features/reporting/reporting.module";
import { RouterModule } from "@angular/router";
import { TodosModule } from "./features/todos/todos.module";
import { waitForChangeTo } from "./core/session/session-states/session-utils";
import { LoginState } from "./core/session/session-states/login-state.enum";
import { APP_INITIALIZER_PROPAGATE_CONFIG_UPDATES } from "./core/config/config.app-initializer";
import { ImportModule } from "./core/import/import.module";
import { ShortcutDashboardWidgetModule } from "./features/dashboard-widgets/shortcut-dashboard-widget/shortcut-dashboard-widget.module";
import { EntityCountDashboardWidgetModule } from "./features/dashboard-widgets/entity-count-dashboard-widget/entity-count-dashboard-widget.module";
import { BirthdayDashboardWidgetModule } from "./features/dashboard-widgets/birthday-dashboard-widget/birthday-dashboard-widget.module";
import { MarkdownPageModule } from "./features/markdown-page/markdown-page.module";
import { LoginStateSubject } from "./core/session/session-type";
import { AdminModule } from "./core/admin/admin.module";
import { Logging } from "./core/logging/logging.service";
import { TemplateExportModule } from "./features/template-export/template-export.module";
import { PublicFormModule } from "./features/public-form/public-form.module";
import { SkillModule } from "./features/skill/skill.module";
import { BulkEditModule } from "./features/bulk-edit/bulk-edit.module";
import { ChangeHistoryModule } from "./features/change-history/change-history.module";
import { ApplicationLoadingComponent } from "./core/config/dynamic-routing/empty/application-loading.component";
import { NotificationService } from "./features/notification/notification.service";
import { AngularFireModule } from "@angular/fire/compat";
import { FirebaseConfiguration } from "./features/notification/notification-config.interface";
import { UserAdminService } from "./core/user/user-admin-service/user-admin.service";
import { KeycloakAdminService } from "./core/user/user-admin-service/keycloak-admin.service";
import { defaultValueStrategyProviders } from "./core/default-values/standard-default-value-strategies";
import { DemoDataModule } from "./core/demo-data/demo-data.module";
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from "@angular/material/form-field";
import { EmailClientServiceModule } from "./features/email-client/email-client.module";
import { DeDuplicationModule } from "./features/de-duplication/de-duplication-module";
/**
* Main entry point of the application.
* Imports required modules and does basic setup.
* Real functionality should be implemented in separate modules and imported here rather than being part of this module.
*/
@NgModule({
declarations: [AppComponent],
bootstrap: [AppComponent],
imports: [
// Global Angular modules
ServiceWorkerModule.register("ngsw-worker.js"),
Angulartics2Module.forRoot({
developerMode: !environment.production,
}),
BrowserModule,
BrowserAnimationsModule,
RouterModule.forRoot(allRoutes, { scrollPositionRestoration: "enabled" }), //to automatically restore scroll position when navigating back to a page.
// Core modules
CoreModule,
ConfigurableEnumModule,
LanguageModule,
LatestChangesModule,
PermissionsModule,
SessionModule,
DashboardModule,
// child-dev modules
AttendanceModule,
ChildrenModule,
NotesModule,
// feature module
ImportModule,
FileModule,
MarkdownPageModule,
LocationModule,
MatchingEntitiesModule,
ProgressDashboardWidgetModule,
ShortcutDashboardWidgetModule,
EntityCountDashboardWidgetModule,
BirthdayDashboardWidgetModule,
ReportingModule,
TodosModule,
AdminModule,
TemplateExportModule,
SkillModule,
BulkEditModule,
ChangeHistoryModule,
DeDuplicationModule,
DemoDataModule,
EmailClientServiceModule,
PublicFormModule,
// top level component
UiComponent,
// Global Angular Material modules
MatSnackBarModule,
MatDialogModule,
ApplicationLoadingComponent,
AngularFireModule.initializeApp(
environment.notificationsConfig as FirebaseConfiguration,
),
],
providers: [
...Logging.getAngularTracingProviders(),
provideZoneChangeDetection(),
{ provide: ComponentRegistry, useValue: componentRegistry },
{ provide: EntityRegistry, useValue: entityRegistry },
{ provide: UserAdminService, useClass: KeycloakAdminService },
{ provide: WINDOW_TOKEN, useValue: window },
{ provide: LOCATION_TOKEN, useValue: window.location },
{ provide: NAVIGATOR_TOKEN, useValue: navigator },
{
provide: LOCALE_ID,
useValue:
localStorage.getItem(LANGUAGE_LOCAL_STORAGE_KEY) ?? DEFAULT_LANGUAGE,
},
AnalyticsService,
Angulartics2Matomo,
{ provide: DateAdapter, useClass: DateAdapterWithFormatting },
{
provide: MAT_DATE_FORMATS,
useValue: DATE_FORMATS,
},
{
provide: SwRegistrationOptions,
useFactory: (loginState: LoginStateSubject) => ({
enabled: environment.production,
registrationStrategy: () =>
loginState.pipe(waitForChangeTo(LoginState.LOGGED_IN)),
}),
deps: [LoginStateSubject],
},
APP_INITIALIZER_PROPAGATE_CONFIG_UPDATES,
provideHttpClient(withXhr(), withInterceptorsFromDi()),
NotificationService,
...defaultValueStrategyProviders,
{
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
useValue: { subscriptSizing: "dynamic" },
},
],
})
export class AppModule {
constructor() {
const icons = inject(FaIconLibrary);
icons.addIconPacks(fas, far);
}
}