From b3a63c4998f656915bdf919d2492118ef160d11e Mon Sep 17 00:00:00 2001 From: Johan Groth Date: Mon, 26 Nov 2018 12:52:57 +0100 Subject: [PATCH] fix(input-field): onChange with number input emits a number instead of string --- src/components/input-field/input-field.tsx | 20 +++++++++++++++---- .../input-field-number/input-field-number.tsx | 8 ++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/components/input-field/input-field.tsx b/src/components/input-field/input-field.tsx index b5d54b3091..85b477d047 100644 --- a/src/components/input-field/input-field.tsx +++ b/src/components/input-field/input-field.tsx @@ -77,12 +77,12 @@ export class InputField { /** * Set to `true` to format the current value of the input field only - * if the field is of the html-type number. + * if the field is of type number. * The number format is determined by the current language of the browser. * Defaults to `true`. */ @Prop({ reflectToAttr: true }) - public formatOnNumber = true; + public formatNumber = true; @State() private mdcTextField; @@ -140,6 +140,7 @@ export class InputField { required={this.required} disabled={this.disabled} type={this.type} + step="any" /> { - this.formatOnNumber = !this.formatOnNumber; + this.formatNumber = !this.formatNumber; }} label={ - this.formatOnNumber + this.formatNumber ? 'Unformat number' : 'Format number' } @@ -53,7 +53,7 @@ export class InputFieldNumberExample { this.changeHandler(event); }} type="number" - formatOnNumber={this.formatOnNumber} + formatNumber={this.formatNumber} disabled={this.disabled} invalid={this.invalid} required={this.required}