1
- import { Component , HostBinding , input , InputSignal } from '@angular/core' ;
1
+ import { Component , computed , input , InputSignal } from '@angular/core' ;
2
2
import { BadgePositions , Colors , Shapes , TextColors } from '../coreui.types' ;
3
3
import { TextBgColorDirective , TextColorDirective } from '../utilities' ;
4
4
@@ -11,7 +11,8 @@ import { TextBgColorDirective, TextColorDirective } from '../utilities';
11
11
{ directive : TextBgColorDirective , inputs : [ 'cTextBgColor: textBgColor' ] }
12
12
] ,
13
13
host : {
14
- class : 'badge'
14
+ class : 'badge' ,
15
+ '[class]' : 'hostClasses()'
15
16
}
16
17
} )
17
18
export class BadgeComponent {
@@ -52,8 +53,7 @@ export class BadgeComponent {
52
53
*/
53
54
readonly textBgColor : InputSignal < Colors | undefined > = input ( ) ;
54
55
55
- @HostBinding ( 'class' )
56
- get hostClasses ( ) : any {
56
+ readonly hostClasses = computed ( ( ) => {
57
57
const position = this . position ( ) ;
58
58
const positionClasses = {
59
59
'position-absolute' : ! ! position ,
@@ -72,6 +72,6 @@ export class BadgeComponent {
72
72
[ `${ this . shape ( ) } ` ] : ! ! this . shape ( )
73
73
} ,
74
74
! ! position ? positionClasses : { }
75
- ) ;
76
- }
75
+ ) as Record < string , boolean > ;
76
+ } ) ;
77
77
}
0 commit comments