Skip to content

Commit a0f37b3

Browse files
committed
refactor(placeholder): use @input() transform
1 parent fa3dffe commit a0f37b3

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

projects/coreui-angular/src/lib/placeholder/placeholder.directive.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Directive, HostBinding, Input } from '@angular/core';
2-
import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
1+
import { booleanAttribute, Directive, HostBinding, Input } from '@angular/core';
32

43
@Directive({
54
selector: '[cPlaceholder]',
@@ -8,26 +7,15 @@ import { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';
87
})
98
export class PlaceholderDirective {
109

11-
static ngAcceptInputType_visible: BooleanInput;
12-
13-
constructor() { }
14-
1510
/**
1611
* placeholder toggler
1712
* @type boolean
1813
* @default false
1914
*/
20-
@Input('cPlaceholder')
21-
set visible(value: boolean) {
22-
this._visible = coerceBooleanProperty(value);
23-
}
24-
get visible() {
25-
return this._visible;
26-
}
27-
private _visible: boolean = false;
15+
@Input({ alias: 'cPlaceholder', transform: booleanAttribute }) visible: boolean = false;
2816

2917
/**
30-
* Size the placeholder extra small, small, large.
18+
* Size the placeholder extremely small, small, large.
3119
*/
3220
@Input('cPlaceholderSize') size?: 'xs' | 'sm' | 'lg';
3321

0 commit comments

Comments
 (0)