From b37df2c84f484e478531880cb9f914f39e8729bc Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 26 Mar 2023 16:16:24 +0200 Subject: [PATCH] Bugfix/fix algebraic sign in value component (#1811) * Fix algebraic sign by resetting member variables * Update changelog --- CHANGELOG.md | 6 ++++++ libs/ui/src/lib/value/value.component.ts | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df4626150..ad96fde42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Fixed an issue with the algebraic sign in the value component + ## 1.248.0 - 2023-03-25 ### Added diff --git a/libs/ui/src/lib/value/value.component.ts b/libs/ui/src/lib/value/value.component.ts index d92d87cb1..e4b7779e9 100644 --- a/libs/ui/src/lib/value/value.component.ts +++ b/libs/ui/src/lib/value/value.component.ts @@ -37,6 +37,8 @@ export class ValueComponent implements OnChanges { public constructor() {} public ngOnChanges() { + this.initializeVariables(); + if (this.value || this.value === 0) { if (isNumber(this.value)) { this.isNumber = true; @@ -120,4 +122,12 @@ export class ValueComponent implements OnChanges { this.useAbsoluteValue = true; } } + + private initializeVariables() { + this.absoluteValue = 0; + this.formattedValue = ''; + this.isNumber = false; + this.isString = false; + this.useAbsoluteValue = false; + } }