In an app we're building using Wijmo and Angular2 one of the requirements is related to the handling of floating-point numbers with different precission. Since the number of digits behind the decimal point may change, we tried to bind the 'format' attribute of the wj-input-number widget to the property DataFormat that we've obtained from the object that our servers returns. Example:
<wj-input-number [attr.id]='inpProp.Name' [attr.format]='inpProp.DataFormat' class="form-control" [(value)]='inpProp.DoubleValue'></wj-input-number>
The following method is executed inside the ngAfterViewInit() method of our component, in order to attach the precission of each input to the 'format attribute'
addPrecissionProperties(inputGroup:InputGroup) {
for (let group of inputGroup.InputProperties) {
if (group.Type == "double") {
group.DataFormat = 'F' + group.Precision;
}
}
}
While the hard-coded version works fine, with a code example like the one below running smoothly, we're having trouble binding the 'format' attribute dinamically, and we already checked that we're not in front of a syntax issue regarding Angular2.
<wj-input-number [attr.id]='inpProp.Name' [attr.format]='F5' class="form-control" [(value)]='inpProp.DoubleValue'></wj-input-number>
Anyone knows why it doesn't behave dinamically as it should? Any help would be very appreciated.