I do have an input field which is populated with JSON object data.
dimension: {
length: 10.00,
width: 20.00,
height: 30.00,
}
The input looks like this:
<input matInput [placeholder]="Dimension (LxHxW)" formControlName="dimensions"
name="dimensions" mask="00.0x00.0x00.0" [specialCharacters]="['x', '.']"
[clearIfNotMatch]="true" [showMaskTyped]="true"
/>
where dimensions is built in typescript code as:
let dimensions = null;
if (dimensionObject) {
dimensions = '' + dimensionObject.length + 'x' + dimensionObject.width + 'x'
+ dimensionObject.height;
}
The goal is to map correctly the data on the mask and obtain the length, width and height concatenated with an x in between-> obtain a flexible mask.
The problem appears when dimensions values are of different length:
e.g. if dimension is 2.3 x 12.3 x 42.2 instead of 2.3 x 12.3 x 42.2 it will show 23.1 x 23.4 x 22. ( x shifted).
Any solutions you guys can spot?