From ce484c5890203c648ef50e71cf80c8861421a44d Mon Sep 17 00:00:00 2001 From: Quentin Date: Mon, 22 Jul 2024 22:22:16 +0200 Subject: [PATCH] Angular: uses Signal --- .../oauth2/domain/AngularOauth2ModuleFactory.java | 8 ++++---- .../core/src/main/webapp/app/app.component.html.mustache | 4 ++-- .../src/main/webapp/app/app.component.spec.ts.mustache | 2 +- .../core/src/main/webapp/app/app.component.ts.mustache | 6 +++--- .../angular/core/domain/AngularModuleFactoryTest.java | 2 +- src/test/resources/projects/angular/app.component.spec.ts | 2 +- src/test/resources/projects/angular/app.component.ts | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java index 6b36f381ecb..94af7af14a1 100644 --- a/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java +++ b/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java @@ -73,7 +73,7 @@ public class AngularOauth2ModuleFactory { import { Oauth2AuthService } from './auth/oauth2-auth.service'; """; - private static final ElementReplacer APPNAME_NEEDLE = lineAfterRegex("appName = '';"); + private static final ElementReplacer APPNAME_NEEDLE = lineAfterRegex("appName = signal\\(''\\);"); private static final String INJECT_OAUTH2_AUTH_SERVICE = """ @@ -87,10 +87,10 @@ public class AngularOauth2ModuleFactory { private static final String INJECT_IMPORT = """ - import { Component, inject, OnInit } from '@angular/core'; + import { Component, inject, OnInit, signal } from '@angular/core'; """; - private static final ElementReplacer INJECT_NEEDLE = text("import { Component, OnInit } from '@angular/core';"); + private static final ElementReplacer INJECT_NEEDLE = text("import { Component, OnInit, signal } from '@angular/core';"); private static final ElementReplacer BEFORE_EACH_NEEDLE = lineAfterRegex("comp = fixture.componentInstance;"); @@ -173,7 +173,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) { .add(fileStart(), LOGIN_IMPORT) .add(INJECT_NEEDLE, INJECT_IMPORT) .add(APPNAME_NEEDLE, INJECT_OAUTH2_AUTH_SERVICE) - .add(lineAfterRegex("this.appName = '" + properties.projectBaseName().name() + "';"), INIT_AUTHENTICATION) + .add(lineAfterRegex("this.appName.set\\('" + properties.projectBaseName().name() + "'\\);"), INIT_AUTHENTICATION) .and() .in(path("src/main/webapp/app/app.component.spec.ts")) .add(fileStart(), TEST_IMPORTS) diff --git a/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.html.mustache b/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.html.mustache index e5e27f17481..f9c3dc6bbfd 100644 --- a/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.html.mustache +++ b/src/main/resources/generator/client/angular/core/src/main/webapp/app/app.component.html.mustache @@ -5,7 +5,7 @@ - {{ appName }} + {{ appName() }} @@ -23,7 +23,7 @@