diff --git a/projects/kit/components/badged-content/badged-content.component.ts b/projects/kit/components/badged-content/badged-content.component.ts index a0750a078a0c..f1e7e8d94f18 100644 --- a/projects/kit/components/badged-content/badged-content.component.ts +++ b/projects/kit/components/badged-content/badged-content.component.ts @@ -1,4 +1,9 @@ -import {ChangeDetectionStrategy, Component} from '@angular/core'; +import { + ChangeDetectionStrategy, + ChangeDetectorRef, + Component, + inject, +} from '@angular/core'; import {WaResizeObserver} from '@ng-web-apis/resize-observer'; import {TuiBadgedContentDirective} from './badged-content.directive'; @@ -11,4 +16,10 @@ import {TuiBadgedContentDirective} from './badged-content.directive'; styleUrls: ['./badged-content.style.less'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class TuiBadgedContentComponent {} +export class TuiBadgedContentComponent { + private readonly cdr = inject(ChangeDetectorRef); + + public onResize(): void { + this.cdr.detectChanges(); + } +} diff --git a/projects/kit/components/badged-content/badged-content.template.html b/projects/kit/components/badged-content/badged-content.template.html index 5eb14d770ce1..4b0a63601f92 100644 --- a/projects/kit/components/badged-content/badged-content.template.html +++ b/projects/kit/components/badged-content/badged-content.template.html @@ -4,7 +4,7 @@ #badgeTop class="t-badge t-badge_top" [style.--t-badge-height.px]="badgeTop.offsetHeight" - (waResizeObserver)="(0)" + (waResizeObserver)="onResize()" >
@@ -16,7 +16,7 @@ #badgeBottom class="t-badge t-badge_bottom" [style.--t-badge-height.px]="badgeBottom.offsetHeight" - (waResizeObserver)="(0)" + (waResizeObserver)="onResize()" >