1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-05 19:23:19 +00:00

move afterNextRender into constructor

This commit is contained in:
jaasen-livefront
2025-10-21 11:37:17 -07:00
parent d465dd9297
commit b622d4f76d

View File

@@ -1,5 +1,4 @@
import {
AfterViewInit,
Component,
computed,
ElementRef,
@@ -43,7 +42,7 @@ let nextId = 0;
templateUrl: "callout.component.html",
imports: [A11yTitleDirective, SharedModule, TypographyModule],
})
export class CalloutComponent implements AfterViewInit {
export class CalloutComponent {
readonly type = input<CalloutTypes>("info");
readonly icon = input<string>();
readonly title = input<string>();
@@ -71,9 +70,7 @@ export class CalloutComponent implements AfterViewInit {
private contentRef!: ElementRef<HTMLElement>;
readonly contentText = signal("");
constructor(private i18nService: I18nService) {}
ngAfterViewInit() {
constructor(private i18nService: I18nService) {
// use afterNextRender to ensure the DOM content is available
afterNextRender(() => {
this.contentText.set(this.contentRef?.nativeElement?.textContent?.trim() ?? "");