mirror of
https://github.com/mempool/mempool.git
synced 2025-03-01 01:00:00 +01:00
25 lines
587 B
TypeScript
25 lines
587 B
TypeScript
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
|
|
|
|
@Component({
|
|
selector: 'app-change',
|
|
templateUrl: './change.component.html',
|
|
styleUrls: ['./change.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
})
|
|
export class ChangeComponent implements OnChanges {
|
|
@Input() current: number;
|
|
@Input() previous: number;
|
|
|
|
change: number;
|
|
|
|
constructor() { }
|
|
|
|
ngOnChanges(): void {
|
|
if (!this.previous) {
|
|
this.change = 0;
|
|
} else {
|
|
this.change = (this.current - this.previous) / this.previous * 100;
|
|
}
|
|
}
|
|
|
|
}
|