Update to Angular v19 and fixing #3

Merged
sandre merged 41 commits from fix/error-after-update-angular-19 into master 2026-01-20 10:56:35 +00:00
6 changed files with 44 additions and 44 deletions
Showing only changes of commit 0b7408a230 - Show all commits

View File

@@ -63,7 +63,7 @@
"fileReplacements": [ "fileReplacements": [
{ {
"replace": "src/environments/environment.ts", "replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts" "with": "src/environments/environment.dev.ts"
} }
] ]
} }

View File

@@ -2,11 +2,7 @@ import { inject, provideAppInitializer } from "@angular/core";
import { ApplicationConfig, provideZoneChangeDetection } from "@angular/core"; import { ApplicationConfig, provideZoneChangeDetection } from "@angular/core";
import { provideRouter } from "@angular/router"; import { provideRouter } from "@angular/router";
import { DatePipe } from "@angular/common"; import { DatePipe } from "@angular/common";
import { import { HTTP_INTERCEPTORS, provideHttpClient } from "@angular/common/http";
HttpClient,
HTTP_INTERCEPTORS,
provideHttpClient,
} from "@angular/common/http";
import { DateService } from "../services/date.service"; import { DateService } from "../services/date.service";
import { AircraftService } from "../services/aircraft.service"; import { AircraftService } from "../services/aircraft.service";
@@ -31,17 +27,9 @@ import { environment } from "../environments/environment";
import { routes } from "./app.routes"; import { routes } from "./app.routes";
import { import { provideTranslateService } from "@ngx-translate/core";
provideTranslateService,
provideTranslateLoader,
} from "@ngx-translate/core";
import { provideTranslateHttpLoader } from "@ngx-translate/http-loader"; import { provideTranslateHttpLoader } from "@ngx-translate/http-loader";
// AOT compilation support
// export function httpTranslateLoader(http: HttpClient) {
// return new TranslateHttpLoader(http);
// }
// Déclaration de la fonction d'initialisation de la configuration // Déclaration de la fonction d'initialisation de la configuration
export function initConfig(configService: ConfigurationHelper) { export function initConfig(configService: ConfigurationHelper) {
return () => configService.load(environment.env); return () => configService.load(environment.env);

View File

@@ -1,4 +1,4 @@
{ {
"apiUrl": "http://localhost:5000", "apiUrl": "http://localhost:5000",
"version": "0.28.0" "version": "0.28.0 DEV"
} }

View File

@@ -1,4 +1,4 @@
{ {
"apiUrl": "https://test-divelog.sebastienandre.com", "apiUrl": "https://test-divelog.sebastienandre.com",
"version": "0.28.0" "version": "0.28.0 PROD"
} }

View File

@@ -0,0 +1,10 @@
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: false,
debugMode: true,
env: "dev"
};

View File

@@ -1,31 +1,33 @@
import { Injectable } from '@angular/core'; import { Injectable } from "@angular/core";
import { HttpClient } from '@angular/common/http'; import { HttpClient } from "@angular/common/http";
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from "rxjs";
import { IAppSettings } from '../models/app-settings';
import { IAppSettings } from "../models/app-settings";
@Injectable({ providedIn: "root" }) @Injectable({ providedIn: "root" })
export class ConfigurationHelper { export class ConfigurationHelper {
private static settingsSource = new BehaviorSubject<IAppSettings>(null); private static settingsSource = new BehaviorSubject<IAppSettings>(null);
public static settings = ConfigurationHelper.settingsSource.asObservable(); public static settings = ConfigurationHelper.settingsSource.asObservable();
constructor(private http: HttpClient) {}
load(env: string) { constructor(private http: HttpClient) {}
const jsonFile = `/config/config.${env}.json`;
return new Promise<void>((resolve, reject) => { load(env: string) {
this.http.get(jsonFile) const jsonFile = `/config/config.${env}.json`;
.toPromise()
.then((response : IAppSettings) => { return new Promise<void>((resolve, reject) => {
ConfigurationHelper.settingsSource.next(<IAppSettings>response); this.http
resolve(); .get(jsonFile)
}) .toPromise()
.catch((response: any) => { .then((response: IAppSettings) => {
reject(`Could not load file '${jsonFile}': ${JSON.stringify(response)}`); ConfigurationHelper.settingsSource.next(<IAppSettings>response);
}); resolve();
})
.catch((response: any) => {
reject(
`Could not load file '${jsonFile}': ${JSON.stringify(response)}`
);
}); });
} });
} }
}