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,10 +1,9 @@
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 {
@@ -17,14 +16,17 @@ export class ConfigurationHelper {
const jsonFile = `/config/config.${env}.json`; const jsonFile = `/config/config.${env}.json`;
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
this.http.get(jsonFile) this.http
.get(jsonFile)
.toPromise() .toPromise()
.then((response : IAppSettings) => { .then((response: IAppSettings) => {
ConfigurationHelper.settingsSource.next(<IAppSettings>response); ConfigurationHelper.settingsSource.next(<IAppSettings>response);
resolve(); resolve();
}) })
.catch((response: any) => { .catch((response: any) => {
reject(`Could not load file '${jsonFile}': ${JSON.stringify(response)}`); reject(
`Could not load file '${jsonFile}': ${JSON.stringify(response)}`
);
}); });
}); });
} }