refactor: migra decoradores a signals (input/output/viewChild/contentChild)
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import { Directive, HostBinding, Input } from '@angular/core';
|
||||
import { Directive, HostBinding, input } from '@angular/core';
|
||||
|
||||
@Directive({ selector: '[pi-value]', })
|
||||
export class PiValueDirective {
|
||||
@HostBinding('class') get classes(): string | boolean {
|
||||
return ['pi-value', this.value > 0 ? 'is-positive' : 'is-negative'].join(' ');
|
||||
return ['pi-value', this.value() > 0 ? 'is-positive' : 'is-negative'].join(' ');
|
||||
}
|
||||
|
||||
@Input() value!: number;
|
||||
readonly value = input.required<number>();
|
||||
|
||||
checkValue(): string {
|
||||
if (this.value > 0) {
|
||||
if (this.value() > 0) {
|
||||
return 'is-positive';
|
||||
} else {
|
||||
return 'is-negative';
|
||||
|
||||
Reference in New Issue
Block a user