1616 See the License for the specific language governing permissions and
1717 limitations under the License.
1818- %>
19- import { inject, Input , Directive, ElementRef, OnChanges, OnInit, OnDestroy } from '@angular/core';
19+ import { inject, input , Directive, ElementRef, OnChanges, OnInit, OnDestroy } from '@angular/core';
2020import { TranslateService } from '@ngx-translate/core';
2121import { Subject } from 'rxjs';
2222import { takeUntil } from 'rxjs/operators';
@@ -30,8 +30,8 @@ import { translationNotFoundMessage } from 'app/config/translation.config';
3030 selector: '[<%= jhiPrefix %> Translate]',
3131})
3232export default class TranslateDirective implements OnChanges, OnInit, OnDestroy {
33- @Input() <%= jhiPrefix %> Translate!: string;
34- @Input() translateValues?: Record<string , unknown >;
33+ readonly <%= jhiPrefix %> Translate = input.required< string >() ;
34+ readonly translateValues = input< Record <string, unknown >>() ;
3535
3636 private readonly directiveDestroyed = new Subject();
3737
@@ -58,13 +58,13 @@ export default class TranslateDirective implements OnChanges, OnInit, OnDestroy
5858
5959 private getTranslation(): void {
6060 this.translateService
61- .get(this.<%= jhiPrefix %> Translate, this.translateValues)
61+ .get(this.<%= jhiPrefix %> Translate() , this.translateValues() )
6262 .pipe(takeUntil(this.directiveDestroyed))
6363 .subscribe({
6464 next: value => {
6565 this.el.nativeElement.innerHTML = value;
6666 },
67- error: () => `${translationNotFoundMessage}[${this.<%= jhiPrefix %> Translate}]`
67+ error: () => `${translationNotFoundMessage}[${this.<%= jhiPrefix %> Translate() }]`
6868 });
6969 }
7070}
0 commit comments