diff --git a/generators/angular/templates/src/main/webapp/app/shared/language/translate.directive.ts.ejs b/generators/angular/templates/src/main/webapp/app/shared/language/translate.directive.ts.ejs index 874f8348e77a..0d831ca28201 100644 --- a/generators/angular/templates/src/main/webapp/app/shared/language/translate.directive.ts.ejs +++ b/generators/angular/templates/src/main/webapp/app/shared/language/translate.directive.ts.ejs @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. -%> -import { inject, Input, Directive, ElementRef, OnChanges, OnInit, OnDestroy } from '@angular/core'; +import { inject, input, Directive, ElementRef, OnChanges, OnInit, OnDestroy } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @@ -30,8 +30,8 @@ import { translationNotFoundMessage } from 'app/config/translation.config'; selector: '[<%= jhiPrefix %>Translate]', }) export default class TranslateDirective implements OnChanges, OnInit, OnDestroy { - @Input() <%= jhiPrefix %>Translate!: string; - @Input() translateValues?: Record; + readonly <%= jhiPrefix %>Translate = input.required(); + readonly translateValues = input>(); private readonly directiveDestroyed = new Subject(); @@ -58,13 +58,13 @@ export default class TranslateDirective implements OnChanges, OnInit, OnDestroy private getTranslation(): void { this.translateService - .get(this.<%= jhiPrefix %>Translate, this.translateValues) + .get(this.<%= jhiPrefix %>Translate(), this.translateValues()) .pipe(takeUntil(this.directiveDestroyed)) .subscribe({ next: value => { this.el.nativeElement.innerHTML = value; }, - error: () => `${translationNotFoundMessage}[${this.<%= jhiPrefix %>Translate}]` + error: () => `${translationNotFoundMessage}[${this.<%= jhiPrefix %>Translate()}]` }); } }