fix: display real number
This commit is contained in:
parent
43e321c0d6
commit
81ec7122ea
1 changed files with 6 additions and 1 deletions
|
@ -61,6 +61,9 @@ export class AnimatedNumberComponent implements OnChanges, AfterViewInit {
|
||||||
this.countUp = new CountUp(this.numberElement.nativeElement, this.value, {
|
this.countUp = new CountUp(this.numberElement.nativeElement, this.value, {
|
||||||
startVal: this.previousValue,
|
startVal: this.previousValue,
|
||||||
duration: this.duration,
|
duration: this.duration,
|
||||||
|
decimalPlaces: 2,
|
||||||
|
useEasing: true,
|
||||||
|
useGrouping: false, // We'll handle grouping in the formatting function
|
||||||
easingFn: (t, b, c, d) => {
|
easingFn: (t, b, c, d) => {
|
||||||
if (this.ease === 'power1.out') {
|
if (this.ease === 'power1.out') {
|
||||||
return c * (1 - Math.pow(1 - t / d, 1)) + b;
|
return c * (1 - Math.pow(1 - t / d, 1)) + b;
|
||||||
|
@ -68,12 +71,14 @@ export class AnimatedNumberComponent implements OnChanges, AfterViewInit {
|
||||||
return c * (t / d) + b;
|
return c * (t / d) + b;
|
||||||
},
|
},
|
||||||
formattingFn: (value) => {
|
formattingFn: (value) => {
|
||||||
|
// Ensure we preserve the exact decimal value during animation
|
||||||
|
const numericValue = typeof value === 'string' ? parseFloat(value) : value;
|
||||||
const formatted = new Intl.NumberFormat('de-DE', {
|
const formatted = new Intl.NumberFormat('de-DE', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'EUR',
|
currency: 'EUR',
|
||||||
minimumFractionDigits: 2,
|
minimumFractionDigits: 2,
|
||||||
maximumFractionDigits: 2,
|
maximumFractionDigits: 2,
|
||||||
}).format(value);
|
}).format(numericValue);
|
||||||
this.formattedValue = formatted;
|
this.formattedValue = formatted;
|
||||||
return formatted;
|
return formatted;
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue