From 59294fd167fdb42d7868a5dd16d3472f5b7ac06e Mon Sep 17 00:00:00 2001 From: Tim Cremer Date: Fri, 29 Nov 2024 10:14:42 +0100 Subject: [PATCH 1/2] Use inject instead of constructor injection --- src/main/webapp/app/faq/faq.routes.ts | 4 ++-- src/main/webapp/app/faq/faq.service.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/app/faq/faq.routes.ts b/src/main/webapp/app/faq/faq.routes.ts index 0b756a8c28ff..bb14572680fd 100644 --- a/src/main/webapp/app/faq/faq.routes.ts +++ b/src/main/webapp/app/faq/faq.routes.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { HttpResponse } from '@angular/common/http'; import { ActivatedRouteSnapshot, Resolve } from '@angular/router'; import { Observable, of } from 'rxjs'; @@ -8,7 +8,7 @@ import { Faq } from 'app/entities/faq.model'; @Injectable({ providedIn: 'root' }) export class FaqResolve implements Resolve { - constructor(private faqService: FaqService) {} + protected faqService = inject(FaqService); resolve(route: ActivatedRouteSnapshot): Observable { const faqId = route.params['faqId']; diff --git a/src/main/webapp/app/faq/faq.service.ts b/src/main/webapp/app/faq/faq.service.ts index 8542fd814c49..2b8e8a5dd546 100644 --- a/src/main/webapp/app/faq/faq.service.ts +++ b/src/main/webapp/app/faq/faq.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { HttpClient, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -12,7 +12,7 @@ type EntityArrayResponseType = HttpResponse; export class FaqService { public resourceUrl = 'api/courses'; - constructor(protected http: HttpClient) {} + private http = inject(HttpClient); create(courseId: number, faq: Faq): Observable { const copy = FaqService.convertFaqFromClient(faq); From e739f408810ce61748a63d92ced96147287c7042 Mon Sep 17 00:00:00 2001 From: Tim Cremer Date: Fri, 29 Nov 2024 10:20:18 +0100 Subject: [PATCH 2/2] make service private --- src/main/webapp/app/faq/faq.routes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/app/faq/faq.routes.ts b/src/main/webapp/app/faq/faq.routes.ts index bb14572680fd..88b75dbdb00f 100644 --- a/src/main/webapp/app/faq/faq.routes.ts +++ b/src/main/webapp/app/faq/faq.routes.ts @@ -8,7 +8,7 @@ import { Faq } from 'app/entities/faq.model'; @Injectable({ providedIn: 'root' }) export class FaqResolve implements Resolve { - protected faqService = inject(FaqService); + private faqService = inject(FaqService); resolve(route: ActivatedRouteSnapshot): Observable { const faqId = route.params['faqId'];